tl;dr: Change Line 446 of crafting.cpp from
if( cou > 0 && one_in( 2 ) ) {
to
if( cou > 0 || one_in( 2 ) ) {
I did a bit more research just now, and it is definitely broken. After cooking 20 lards at skill level 0 and 1, I never consumed any fat. After crafting 5 upgraded solar panels at skill level 0, I consumed the following: 1 solar panel, 30 copper wires, 8 amplifier circuits, 8 solar cells, 2 power converters, and no solder.
According to the comments though (line 444/445 of crafting.cpp)
// Each component currently has 50% chance of not being consumed
// Skip first item so failed craft with one item recipe always loses component
I don’t know how to compile and test exactly what is wrong, but it is certainly not working as intended. My hunch? Line 446 reads:
if( cou > 0 && one_in( 2 ) ) {
But if the comments are correct, it should read:
if( cou > 0 || one_in( 2 ) ) {
Currently, I think that it is never consuming the first thing in the inventory list, instead of always consuming the first thing in the inventory list.