Skip to content

Commit

Permalink
Cannibal food is worthless
Browse files Browse the repository at this point in the history
  • Loading branch information
RenechCDDA committed Nov 17, 2024
1 parent f7725a6 commit e0bc6da
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions data/json/vitamin.json
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@
"type": "vitamin",
"vit_type": "counter",
"name": { "str": "Consumed human flesh" },
"flags": [ "NO_SELL" ],
"min": 0,
"max": 10000,
"rate": "1 h"
Expand Down
10 changes: 10 additions & 0 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ static const vitamin_id vitamin_human_flesh_vitamin( "human_flesh_vitamin" );

// vitamin flags
static const std::string flag_NO_DISPLAY( "NO_DISPLAY" );
static const std::string flag_NO_SELL( "NO_SELL" );

// fault flags
static const std::string flag_BLACKPOWDER_FOULING_DAMAGE( "BLACKPOWDER_FOULING_DAMAGE" );
Expand Down Expand Up @@ -7120,6 +7121,15 @@ int item::price_no_contents( bool practical, std::optional<int> price_override )
price *= fault->price_mod();
}

if( is_food() && get_comestible() ) {
const nutrients &nutrients_value = default_character_compute_effective_nutrients( *this );
for( const std::pair<const vitamin_id, int> &vit_pair : nutrients_value.vitamins() ) {
if( vit_pair.second > 0 && vit_pair.first->has_flag( flag_NO_SELL ) ) {
price = 0.0;
}
}
}

return price;
}

Expand Down

0 comments on commit e0bc6da

Please sign in to comment.