diff --git a/data/json/items/tool/workshop.json b/data/json/items/tool/workshop.json index 59f5034475b92..e7c532e4fff62 100644 --- a/data/json/items/tool/workshop.json +++ b/data/json/items/tool/workshop.json @@ -886,7 +886,7 @@ [ "CHISEL", 3 ], [ "CHISEL_WOOD", 3 ] ], - "use_action": [ "GUN_REPAIR", [ "CROWBAR", 0 ], [ "HAMMER", 0 ] ], + "use_action": [ "GUN_REPAIR", [ "CROWBAR", 0 ], [ "HAMMER", 0 ], [ "HACKSAW", 0 ] ], "flags": [ "ALLOWS_REMOTE_USE" ], "pocket_data": [ { diff --git a/data/mods/TEST_DATA/items.json b/data/mods/TEST_DATA/items.json index 3d47563667ec3..ef3f0d64d90c9 100644 --- a/data/mods/TEST_DATA/items.json +++ b/data/mods/TEST_DATA/items.json @@ -1552,6 +1552,7 @@ "description": "Test hacksaw which uses batteries.", "charges_per_use": 1, "ammo": [ "battery" ], + "use_action": [ [ "HACKSAW", 1 ] ], "pocket_data": [ { "pocket_type": "MAGAZINE_WELL", diff --git a/src/activity_actor.cpp b/src/activity_actor.cpp index 494a58e2bf2b4..206db0bd65af4 100644 --- a/src/activity_actor.cpp +++ b/src/activity_actor.cpp @@ -1052,8 +1052,16 @@ void hacksaw_activity_actor::start( player_activity &act, Character &/*who*/ ) void hacksaw_activity_actor::do_turn( player_activity &/*act*/, Character &who ) { - if( tool->ammo_sufficient( &who ) ) { - tool->ammo_consume( tool->ammo_required(), tool.position(), &who ); + std::string method = "HACKSAW"; + + if( tool->ammo_sufficient( &who, method ) ) { + int ammo_consumed = tool->ammo_required(); + std::map::const_iterator iter = tool->type->ammo_scale.find( method ); + if( iter != tool->type->ammo_scale.end() ) { + ammo_consumed *= iter->second; + } + + tool->ammo_consume( ammo_consumed, tool.position(), &who ); sfx::play_activity_sound( "tool", "hacksaw", sfx::get_heard_volume( target ) ); if( calendar::once_every( 1_minutes ) ) { //~ Sound of a metal sawing tool at work!