Skip to content

Commit

Permalink
Merge pull request #35829 from Fris0uman/para_milk
Browse files Browse the repository at this point in the history
Removes parasites from raw_milk
  • Loading branch information
Rivet-the-Zombie committed Dec 4, 2019
2 parents 172f04f + fd8e349 commit c0cb80b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion data/json/items/comestibles/dairy.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"copy-from": "milk",
"spoils_in": "12 hours",
"price": 19,
"parasites": 11,
"contamination": 5,
"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
2 changes: 2 additions & 0 deletions doc/JSON_INFO.md
Original file line number Diff line number Diff line change
Expand Up @@ -1375,6 +1375,8 @@ CBMs can be defined like this:
"fun" : 50 // Morale effects when used
"freezing_point": 32, // (Optional) Temperature in F at which item freezes, default is water (32F/0C)
"cooks_like": "meat_cooked" // (Optional) If the item is used in a recipe, replaces it with its cooks_like
"parasites": 10, // (Optional) Probability of becoming parasitised when eating
"contamination": 5, // (Optional) Probability to get food poisoning from this comestible. Values must be in the [0, 100] range.
```

### Containers
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 food poisoning from bacterial contamination
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

0 comments on commit c0cb80b

Please sign in to comment.