diff --git a/data/core/basic.json b/data/core/basic.json index a9e3f00242c3d..cb45312e4dc72 100644 --- a/data/core/basic.json +++ b/data/core/basic.json @@ -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" } ] diff --git a/data/json/item_actions.json b/data/json/item_actions.json index a8c339530e03a..086813a01f0e0 100644 --- a/data/json/item_actions.json +++ b/data/json/item_actions.json @@ -294,6 +294,11 @@ "id": "BLECH", "name": "Drink" }, + { + "type": "item_action", + "id": "BLECH_BECAUSE_UNCLEAN", + "name": "Drink" + }, { "type": "item_action", "id": "C4", diff --git a/data/json/items/comestibles/drink.json b/data/json/items/comestibles/drink.json index a1a9363de8fc8..e3e3de982c868 100644 --- a/data/json/items/comestibles/drink.json +++ b/data/json/items/comestibles/drink.json @@ -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", @@ -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": [ ] } ] diff --git a/doc/JSON_FLAGS.md b/doc/JSON_FLAGS.md index a93b7cb17cfcf..312e9ebf765dc 100644 --- a/doc/JSON_FLAGS.md +++ b/doc/JSON_FLAGS.md @@ -428,6 +428,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. diff --git a/src/item_factory.cpp b/src/item_factory.cpp index 3e84cbead8f18..11695c5389478 100644 --- a/src/item_factory.cpp +++ b/src/item_factory.cpp @@ -583,6 +583,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 ); diff --git a/src/iuse.cpp b/src/iuse.cpp index 25bfbff5dadd2..fc831355d959b 100644 --- a/src/iuse.cpp +++ b/src/iuse.cpp @@ -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 ) ) { diff --git a/src/iuse.h b/src/iuse.h index d96153e9f93f1..c2088be163e91 100644 --- a/src/iuse.h +++ b/src/iuse.h @@ -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 & );