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

warn player before drinking water not known to be clean #36065

Merged
merged 8 commits into from
Dec 22, 2019
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 2 additions & 1 deletion data/core/basic.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"container": "bottle_plastic",
"quench": 50,
"ammo_data": { "ammo_type": "water" },
"flags": [ "EATEN_COLD" ]
"flags": [ "EATEN_COLD" ],
"use_action": "BLECH_BECAUSE_UNCLEAN"
}
]
5 changes: 5 additions & 0 deletions data/json/item_actions.json
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,11 @@
"id": "BLECH",
"name": "Drink"
},
{
"type": "item_action",
"id": "BLECH_BECAUSE_UNCLEAN",
"name": "Drink"
},
{
"type": "item_action",
"id": "C4",
Expand Down
6 changes: 4 additions & 2 deletions data/json/items/comestibles/drink.json
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,8 @@
"name": "clean water",
"name_plural": "clean water",
"description": "Fresh, clean water. Truly the best thing to quench your thirst.",
"color": "light_cyan"
"color": "light_cyan",
"use_action": [ ]
},
{
"id": "water_mineral",
Expand All @@ -948,6 +949,7 @@
"description": "Fancy mineral water, so fancy it makes you feel fancy just holding it.",
"container": "bottle_plastic",
"proportional": { "quench": 1.2 },
"relative": { "fun": 1 }
"relative": { "fun": 1 },
"use_action": [ ]
}
]
1 change: 1 addition & 0 deletions doc/JSON_FLAGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,7 @@ Some armor flags, such as `WATCH` and `ALARMCLOCK` are compatible with other ite
- ```BANDAGE``` Stop bleeding.
- ```BIRDFOOD``` Makes a small bird friendly.
- ```BLECH``` Causes vomiting.
- ```BLECH_BECAUSE_UNCLEAN``` Causes warning.
- ```CAFF``` Reduces fatigue.
- ```CATFOOD``` Makes a cat friendly.
- ```CATTLEFODDER``` Makes a large herbivore friendly.
Expand Down
1 change: 1 addition & 0 deletions src/item_factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,7 @@ void Item_factory::init()
add_iuse( "AUTOCLAVE", &iuse::autoclave );
add_iuse( "BELL", &iuse::bell );
add_iuse( "BLECH", &iuse::blech );
add_iuse( "BLECH_BECAUSE_UNCLEAN", &iuse::blech_because_unclean );
add_iuse( "BOLTCUTTERS", &iuse::boltcutters );
add_iuse( "C4", &iuse::c4 );
add_iuse( "CABLE_ATTACH", &iuse::cable_attach );
Expand Down
16 changes: 16 additions & 0 deletions src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -998,6 +998,22 @@ int iuse::blech( player *p, item *it, bool, const tripoint & )
return it->type->charges_to_use();
}

int iuse::blech_because_unclean( player *p, item *it, bool, const tripoint & )
{
if( !p->is_npc() ) {
if( it->made_of( LIQUID ) ) {
if( !p->query_yn( _( "This looks unclean, sure you want to drink it?" ) ) ) {
return 0;
}
} else { //Assume that if a blech consumable isn't a drink, it will be eaten.
if( !p->query_yn( _( "This looks unclean, sure you want to eat it?" ) ) ) {
return 0;
}
}
}
return it->type->charges_to_use();
}

int iuse::plantblech( player *p, item *it, bool, const tripoint &pos )
{
if( p->has_trait( trait_THRESH_PLANT ) ) {
Expand Down
1 change: 1 addition & 0 deletions src/iuse.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class iuse
int flusleep( player *, item *, bool, const tripoint & );
int inhaler( player *, item *, bool, const tripoint & );
int blech( player *, item *, bool, const tripoint & );
int blech_because_unclean( player *, item *, bool, const tripoint & );
int plantblech( player *, item *, bool, const tripoint & );
int chew( player *, item *, bool, const tripoint & );
int purifier( player *, item *, bool, const tripoint & );
Expand Down