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

Merge pull request CleverRaven#40544 from Xenomorph-III/baselard_fix #172

Merged
merged 8 commits into from
May 14, 2020
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
2 changes: 1 addition & 1 deletion data/json/items/melee/swords_and_blades.json
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@
"symbol": ";",
"color": "dark_gray",
"qualities": [ [ "CUT", 1 ], [ "BUTCHER", 15 ] ],
"flags": [ "STAB", "SHEATHE_KNIFE" ]
"flags": [ "STAB", "SHEATH_KNIFE" ]
},
{
"id": "makeshift_machete",
Expand Down
2 changes: 1 addition & 1 deletion data/json/scenarios.json
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@
{
"type": "scenario",
"ident": "presort",
"name": "Crazy party",
"name": "Crazy Party",
"points": 0,
"description": "You thought things couldn't get any worse when the cops came over to bust your wild party, even though you booked it at a private resort. When the guests started fighting with the police you tried to get them to calm down, only to find out they hungered for more.",
"start_name": "Private resort",
Expand Down
5 changes: 3 additions & 2 deletions doc/JSON_INFO.md
Original file line number Diff line number Diff line change
Expand Up @@ -2949,7 +2949,7 @@ A flat multiplier on the harvest count of the plant. For numbers greater than on

### clothing_mod

```JSON
```C++
"type": "clothing_mod",
"id": "leather_padded", // Unique ID.
"flag": "leather_padded", // flag to add to clothing.
Expand Down Expand Up @@ -3316,7 +3316,7 @@ The internal ID of the compatible tilesets. MOD tileset is only applied when bas
Setting of sprite sheets. Same as `tiles-new` field in `tile_config`. Sprite files are loaded from the same folder json file exists.

# Field types

```C++
{
"type": "field_type", // this is a field type
"id": "fd_gum_web", // id of the field
Expand All @@ -3339,3 +3339,4 @@ Setting of sprite sheets. Same as `tiles-new` field in `tile_config`. Sprite fil
]
}
}
```
17 changes: 12 additions & 5 deletions src/consumption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include "enums.h"
#include "flat_set.h"
#include "game.h"
#include "item.h"
#include "item_category.h"
#include "item_contents.h"
#include "itype.h"
#include "iuse_actor.h"
Expand Down Expand Up @@ -1321,8 +1323,10 @@ bool Character::consume_effects( item &food )
units::volume food_vol = food.base_volume() - std::max( water_vol, 0_ml );
units::mass food_weight = ( food.weight() / food.count() ) - units::from_gram( units::to_milliliter(
water_vol ) ); //water is 1 gram per milliliter
double ratio = std::max( static_cast<double>( food_nutrients.kcal ) / units::to_gram( food_weight ),
1.0 );
double ratio = 1.0f;
if( units::to_gram( food_weight ) != 0 ) {
ratio = std::max( static_cast<double>( food_nutrients.kcal ) / units::to_gram( food_weight ), 1.0 );
}

food_summary ingested{
water_vol,
Expand Down Expand Up @@ -1629,7 +1633,8 @@ time_duration Character::get_consume_time( const item &it )
{
const int charges = std::max( it.charges, 1 );
int volume = units::to_milliliter( it.volume() ) / charges;
time_duration time = 0_seconds;
time_duration time = time_duration::from_seconds( std::max( ( volume /
5 ), 1 ) ); //Default 5 mL (1 tablespoon) per second
float consume_time_modifier = 1;//only for food and drinks
const bool eat_verb = it.has_flag( flag_USE_EAT_VERB );
if( eat_verb || it.get_comestible()->comesttype == "FOOD" ) {
Expand Down Expand Up @@ -1664,8 +1669,10 @@ time_duration Character::get_consume_time( const item &it )
} else {
time = time_duration::from_seconds( 5 ); //probably pills so quick
}
} else {
debugmsg( "Consumed something that was not food, drink or medicine/drugs" );
} else if( it.get_category().get_id() == "chems" ) {
time = time_duration::from_seconds( std::max( ( volume / 15 ),
1 ) ); //Consume 15 mL (1 tablespoon) per second
consume_time_modifier = mutation_value( "consume_time_modifier" );
}

return time * consume_time_modifier;
Expand Down