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

Fix display of repair possibility info for items made of certain materials #36155

Merged
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
5 changes: 0 additions & 5 deletions data/json/item_actions.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@
"id": "HOTPLATE",
"name": "Heat up food (with it)"
},
{
"type": "item_action",
"id": "MISC_REPAIR",
"name": "Repair wood/paper/bone/chitin"
},
{
"type": "item_action",
"id": "TOOLMOD_ATTACH",
Expand Down
17 changes: 0 additions & 17 deletions data/mods/More_Survival_Tools/items.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,4 @@
[
{
"id": "resin_cord",
"type": "COMESTIBLE",
"comestible_type": "MED",
"category": "spare_parts",
"name": "resinous cord",
"description": "Primitive binding material made of cords and natural glue. Use it to repair items made of wood, paper, bone, or chitin.",
"weight": 140,
"volume": 1,
"price": 100,
"material": "cotton",
"symbol": ";",
"color": "green",
"charges": 2,
"stack_size": 9,
"use_action": "MISC_REPAIR"
},
{
"id": "atlatl",
"type": "GUN",
Expand Down
10 changes: 10 additions & 0 deletions data/mods/More_Survival_Tools/obsolete.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,15 @@
"id": "bolt_bone",
"type": "MIGRATION",
"replace": "bolt_crude"
},
{
"id": "resin_cord",
"type": "MIGRATION",
"replace": "slime_scrap"
},
{
"type": "recipe",
"result": "resin_cord",
"obsolete": true
}
]
27 changes: 0 additions & 27 deletions data/mods/More_Survival_Tools/recipes.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,33 +46,6 @@
"tools": [ [ [ "surface_heat", 10, "LIST" ] ] ],
"components": [ [ [ "raw_fur", 1 ], [ "raw_tainted_fur", 1 ] ] ]
},
{
"type": "recipe",
"result": "resin_cord",
"category": "CC_OTHER",
"subcategory": "CSC_OTHER_MATERIALS",
"skill_used": "survival",
"skills_required": [ "fabrication", 1 ],
"difficulty": 3,
"time": 24000,
"autolearn": true,
"batch_time_factors": [ 50, 5 ],
"book_learn": [ [ "mag_survival", 2 ], [ "textbook_survival", 1 ] ],
"qualities": [ { "id": "CUT", "level": 1 }, { "id": "COOK", "level": 2 } ],
"tools": [ [ [ "surface_heat", 5, "LIST" ] ] ],
"components": [
[ [ "bone", 10 ], [ "cured_hide", 2 ], [ "pine_bough", 2 ], [ "raw_dandelion", 10 ], [ "slime_scrap", 1 ] ],
[
[ "rag", 1 ],
[ "felt_patch", 1 ],
[ "cordage_short", 2, "LIST" ],
[ "plant_fibre", 50 ],
[ "sinew", 50 ],
[ "thread", 50 ],
[ "yarn", 50 ]
]
]
},
{
"type": "recipe",
"result": "atlatl",
Expand Down
17 changes: 0 additions & 17 deletions src/item_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,11 +388,6 @@ void Item_factory::register_cached_uses( const itype &obj )
if( e.first == "GUN_REPAIR" ) {
gun_tools.insert( obj.id );
}

// can this item be used to repair wood/paper/bone/chitin items?
if( e.first == "MISC_REPAIR" ) {
misc_tools.insert( obj.id );
}
}
}

Expand All @@ -404,16 +399,6 @@ void Item_factory::finalize_post( itype &obj )
return;
}

// handle wood/paper/bone/chitin items as a special case
if( !obj.gun && !obj.count_by_charges() && std::any_of( obj.materials.begin(), obj.materials.end(),
[]( const material_id & m ) {
return m == material_id( "wood" ) || m == material_id( "paper" ) ||
m == material_id( "bone" ) || m == material_id( "chitin" ) || m == material_id( "acidchitin" );
} ) ) {
std::copy( misc_tools.begin(), misc_tools.end(), std::inserter( obj.repair, obj.repair.begin() ) );
return;
}

// for each item iterate through potential repair tools
for( const auto &tool : repair_tools ) {

Expand Down Expand Up @@ -703,7 +688,6 @@ void Item_factory::init()
add_iuse( "MEDITATE", &iuse::meditate );
add_iuse( "METH", &iuse::meth );
add_iuse( "MININUKE", &iuse::mininuke );
add_iuse( "MISC_REPAIR", &iuse::misc_repair );
add_iuse( "MOLOTOV_LIT", &iuse::molotov_lit );
add_iuse( "MOP", &iuse::mop );
add_iuse( "MP3", &iuse::mp3 );
Expand Down Expand Up @@ -2371,7 +2355,6 @@ void Item_factory::clear()

repair_tools.clear();
gun_tools.clear();
misc_tools.clear();
repair_actions.clear();

frozen = false;
Expand Down
3 changes: 0 additions & 3 deletions src/item_factory.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,9 +363,6 @@ class Item_factory
// tools that can be used to repair complex firearms
std::set<itype_id> gun_tools;

// tools that can be used to repair wood/paper/bone/chitin items
std::set<itype_id> misc_tools;

std::set<std::string> repair_actions;
};

Expand Down
84 changes: 0 additions & 84 deletions src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6004,90 +6004,6 @@ int iuse::toolmod_attach( player *p, item *it, bool, const tripoint & )
return 0;
}

int iuse::misc_repair( player *p, item *it, bool, const tripoint & )
{
if( !it->ammo_sufficient() ) {
return 0;
}
if( p->is_underwater() ) {
p->add_msg_if_player( m_info, _( "You can't do that while underwater." ) );
return 0;
}
if( p->is_mounted() ) {
p->add_msg_if_player( m_info, _( "You cannot do that while mounted." ) );
return 0;
}
if( p->fine_detail_vision_mod() > 4 ) {
p->add_msg_if_player( m_info, _( "You can't see to repair!" ) );
return 0;
}
/** @EFFECT_FABRICATION >0 allows use of repair kit */
if( p->get_skill_level( skill_fabrication ) < 1 ) {
p->add_msg_if_player( m_info, _( "You need a fabrication skill of 1 to use this repair kit." ) );
return 0;
}
static const std::set<material_id> repairable{
material_id( "wood" ),
material_id( "paper" ),
material_id( "bone" ),
material_id( "chitin" ),
material_id( "acidchitin" )
};

auto filter = []( const item & itm ) {
return !itm.is_firearm() && itm.made_of_any( repairable ) && !itm.count_by_charges();
};

item_location loc;
avatar *you = p->as_avatar();
if( you != nullptr ) {
loc = game_menus::inv::titled_filter_menu(
filter, *you, _( "Select the item to repair" ) );
}

if( !loc ) {
p->add_msg_if_player( m_info, _( "You do not have that item!" ) );
return 0;
}
item &fix = *loc;

if( fix.damage() <= fix.min_damage() ) {
p->add_msg_if_player( m_info, _( "You cannot improve your %s any more this way." ),
fix.tname() );
return 0;
}
if( fix.damage() <= 0 && fix.has_flag( "PRIMITIVE_RANGED_WEAPON" ) ) {
p->add_msg_if_player( m_info, _( "You cannot improve your %s any more this way." ),
fix.tname() );
return 0;
}
const std::string startdurability = fix.durability_indicator( true );
std::string resultdurability;
if( fix.damage() <= 0 ) {
p->moves -= to_moves<int>( 10_seconds * p->fine_detail_vision_mod() );
p->practice( skill_fabrication, 10 );
fix.mod_damage( -itype::damage_scale );
p->add_msg_if_player( m_good, _( "You reinforce your %s." ), fix.tname() );

} else if( fix.damage() > itype::damage_scale ) {
p->moves -= to_moves<int>( 5_seconds * p->fine_detail_vision_mod() );
p->practice( skill_fabrication, 10 );
fix.mod_damage( -itype::damage_scale );
resultdurability = fix.durability_indicator( true );
p->add_msg_if_player( m_good, _( "You repair your %s! ( %s-> %s)" ), fix.tname( 1, false ),
startdurability, resultdurability );

} else {
p->moves -= to_moves<int>( 3_seconds * p->fine_detail_vision_mod() );
p->practice( skill_fabrication, 10 );
fix.set_damage( 0 );
resultdurability = fix.durability_indicator( true );
p->add_msg_if_player( m_good, _( "You repair your %s completely! ( %s-> %s)" ),
fix.tname( 1, false ), startdurability, resultdurability );
}
return it->type->charges_to_use();
}

int iuse::bell( player *p, item *it, bool, const tripoint & )
{
if( it->typeId() == "cow_bell" ) {
Expand Down
1 change: 0 additions & 1 deletion src/iuse.h
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ class iuse
int gun_repair( player *, item *, bool, const tripoint & );
int gunmod_attach( player *, item *, bool, const tripoint & );
int toolmod_attach( player *, item *, bool, const tripoint & );
int misc_repair( player *, item *, bool, const tripoint & );
int rm13armor_off( player *, item *, bool, const tripoint & );
int rm13armor_on( player *, item *, bool, const tripoint & );
int unpack_item( player *, item *, bool, const tripoint & );
Expand Down