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

Removes parasites from raw_milk #35829

Merged
merged 7 commits into from
Dec 4, 2019
Merged
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions data/json/items/comestibles/dairy.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"copy-from": "milk",
"spoils_in": "12 hours",
"price": 19,
"contamination": 30,
Fris0uman marked this conversation as resolved.
Show resolved Hide resolved
"description": "This is raw, unhomogenized and unpasteurized milk from a cow. It couldn't be any fresher unless you drank it straight from the cow, which might upset it. Depending on your dietary sensibilities, you might want to pasteurize or even boil this before drinking."
},
{
Expand Down
8 changes: 8 additions & 0 deletions src/consumption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -949,6 +949,14 @@ bool player::eat( item &food, bool force )
}
}

// chance to get foodpoisoning from bacterial contamination
Fris0uman marked this conversation as resolved.
Show resolved Hide resolved
if( !will_vomit && !has_bionic( bio_digestion ) ) {
const int contamination = food.get_comestible()->contamination;
if( rng( 1, 100 ) <= contamination ) {
add_effect( effect_foodpoison, rng( 6_minutes, ( nutr + 1 ) * 6_minutes ) );
}
}

if( will_vomit ) {
vomit();
}
Expand Down
1 change: 1 addition & 0 deletions src/item_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1678,6 +1678,7 @@ void Item_factory::load( islot_comestible &slot, JsonObject &jo, const std::stri
assign( jo, "stim", slot.stim, strict );
assign( jo, "healthy", slot.healthy, strict );
assign( jo, "parasites", slot.parasites, strict, 0 );
assign( jo, "contamination", slot.contamination, strict, 0, 100 );
assign( jo, "freezing_point", slot.freeze_point, strict );
assign( jo, "spoils_in", slot.spoils, strict, 1_hours );
assign( jo, "cooks_like", slot.cooks_like, strict );
Expand Down
3 changes: 3 additions & 0 deletions src/itype.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,9 @@ struct islot_comestible {
/** chance (odds) of becoming parasitised when eating (zero if never occurs) */
int parasites = 0;

/** probability [0, 100] to get food poisoning from this comestible */
int contamination = 0;

/** freezing point in degrees Fahrenheit, below this temperature item can freeze */
int freeze_point = temperatures::freezing;

Expand Down