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 88be89d
Show file tree
Hide file tree
Showing 2 changed files with 12 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
11 changes: 11 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,16 @@ 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.first->has_flag( flag_NO_SELL ) ) {
price = 0.0;
}
}
}


return price;
}

Expand Down

0 comments on commit 88be89d

Please sign in to comment.