Skip to content

Commit

Permalink
Lets liquid soap be used to clean clothes (#53161)
Browse files Browse the repository at this point in the history
* Make liquid soap a detergent with count 5

As a side effect, it's no longer a comestible and can't be drank, but you probably shouldn't do that anyway.

* Add liquid soap to finish washing

* Attempting to fix liquid error

* Lets liquid soap be used for soapy water crafting

* Fixes alphabetical order

* Dratted whitespace ruining my style

* I think this is what the style checker means now

* Makes liquid soap move to the chemical stuff section

* Surely this isn't what the astyle was complaining about right?

* Wait no it's just something dumb

* Changing it back because it still doesn't like the style

* Ok this should fix it

* Using json linted version

* Reduce long lines

* Testing an exception

* Fixing syntax

* Change count to charges

* Undo unnecessary check

* Change it back to count

* ADD LIQUID SOAP TO THE PLACE IT ACTUALLY BELONGS GITHUB

* Trust me bro (hopefully this actually works)

* Adds checking for unused cleansers

* Appeasing astyle

* Using allman formatting for astyle

* Undoes that because it changed everything

* Trying again with the proper astyle

* Also format all of iuse with the astyle settings

* Reverse some of the changes astyle made

* Refactored washing to use only one component vector

Hopefully it stops sending errors this way

* Nearly missed that one

* Update src/activity_item_handling.cpp

Co-authored-by: Álvaro <[email protected]>

Co-authored-by: Álvaro <[email protected]>
  • Loading branch information
dnworden and GoLoT authored Dec 16, 2021
1 parent 3d0ca92 commit ecf5540
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
12 changes: 5 additions & 7 deletions data/json/items/chemicals_and_resources.json
Original file line number Diff line number Diff line change
Expand Up @@ -1745,24 +1745,22 @@
"count": 100
},
{
"type": "COMESTIBLE",
"type": "AMMO",
"id": "liquid_soap",
"name": { "str_sp": "liquid soap" },
"category": "chems",
"weight": "260 g",
"color": "light_cyan",
"container": "bottle_bathroom",
"sealed": false,
"comestible_type": "DRINK",
"symbol": "~",
"quench": -90,
"healthy": -20,
"description": "Liquid soap.",
"price": 0,
"price_postapoc": 0,
"volume": "250 ml",
"phase": "liquid",
"category": "chems",
"freezing_point": -2,
"fun": -50
"ammo_type": "components",
"flags": [ "DETERGENT" ],
"count": 5
}
]
5 changes: 4 additions & 1 deletion data/json/recipes/recipe_medsandchemicals.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@
"time": "1 m",
"autolearn": true,
"flags": [ "BLIND_HARD" ],
"components": [ [ [ "water_clean", 1 ], [ "water", 1 ] ], [ [ "soap", 1 ], [ "soap_flakes", 15 ], [ "detergent", 1 ] ] ]
"components": [
[ [ "water_clean", 1 ], [ "water", 1 ] ],
[ [ "soap", 1 ], [ "soap_flakes", 15 ], [ "detergent", 1 ], [ "liquid_soap", 1 ] ]
]
},
{
"type": "recipe",
Expand Down
6 changes: 5 additions & 1 deletion src/activity_item_handling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ static const efftype_id effect_incorporeal( "incorporeal" );
static const itype_id itype_battery( "battery" );
static const itype_id itype_detergent( "detergent" );
static const itype_id itype_disassembly( "disassembly" );
static const itype_id itype_liquid_soap( "liquid_soap" );
static const itype_id itype_log( "log" );
static const itype_id itype_mop( "mop" );
static const itype_id itype_soap( "soap" );
Expand Down Expand Up @@ -506,7 +507,9 @@ void activity_handlers::washing_finish( player_activity *act, Character *you )
act->set_to_null();
return;
} else if( !crafting_inv.has_charges( itype_soap, required.cleanser ) &&
!crafting_inv.has_charges( itype_detergent, required.cleanser ) ) {
!crafting_inv.has_charges( itype_detergent, required.cleanser ) &&
!crafting_inv.has_charges( itype_liquid_soap, required.cleanser,
is_liquid_crafting_component ) ) {
you->add_msg_if_player( _( "You need %1$i charges of cleansing agent to wash these items." ),
required.cleanser );
act->set_to_null();
Expand All @@ -527,6 +530,7 @@ void activity_handlers::washing_finish( player_activity *act, Character *you )
std::vector<item_comp> comps1;
comps1.emplace_back( itype_soap, required.cleanser );
comps1.emplace_back( itype_detergent, required.cleanser );
comps1.emplace_back( itype_liquid_soap, required.cleanser );
you->consume_items( comps1 );

you->add_msg_if_player( m_good, _( "You washed your items." ) );
Expand Down
7 changes: 5 additions & 2 deletions src/iuse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ static const itype_id itype_handrolled_cig( "handrolled_cig" );
static const itype_id itype_heatpack_used( "heatpack_used" );
static const itype_id itype_hygrometer( "hygrometer" );
static const itype_id itype_joint( "joint" );
static const itype_id itype_liquid_soap( "liquid_soap" );
static const itype_id itype_log( "log" );
static const itype_id itype_mask_h20survivor_on( "mask_h20survivor_on" );
static const itype_id itype_mininuke_act( "mininuke_act" );
Expand Down Expand Up @@ -9299,7 +9300,8 @@ cata::optional<int> iuse::wash_items( Character *p, bool soft_items, bool hard_i
crafting_inv.charges_of( itype_water_clean, INT_MAX, is_liquid )
);
int available_cleanser = std::max( crafting_inv.charges_of( itype_soap ),
crafting_inv.charges_of( itype_detergent ) );
std::max( crafting_inv.charges_of( itype_detergent ),
crafting_inv.charges_of( itype_liquid_soap, INT_MAX, is_liquid ) ) );

const inventory_filter_preset preset( [soft_items, hard_items]( const item_location & location ) {
return location->has_flag( flag_FILTHY ) && ( ( soft_items && location->is_soft() ) ||
Expand Down Expand Up @@ -9358,7 +9360,8 @@ cata::optional<int> iuse::wash_items( Character *p, bool soft_items, bool hard_i
required.water );
return cata::nullopt;
} else if( !crafting_inv.has_charges( itype_soap, required.cleanser ) &&
!crafting_inv.has_charges( itype_detergent, required.cleanser ) ) {
!crafting_inv.has_charges( itype_detergent, required.cleanser ) &&
!crafting_inv.has_charges( itype_liquid_soap, required.cleanser, is_liquid ) ) {
p->add_msg_if_player( _( "You need %1$i charges of cleansing agent to wash these items." ),
required.cleanser );
return cata::nullopt;
Expand Down

0 comments on commit ecf5540

Please sign in to comment.