Skip to content

Commit

Permalink
Merge pull request #10 from CleverRaven/master
Browse files Browse the repository at this point in the history
Bring up-to-date
  • Loading branch information
Inglonias authored Dec 27, 2018
2 parents d20e7ae + d86f74d commit 7c6ef21
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 27 deletions.
4 changes: 2 additions & 2 deletions GUIDE_COMESTIBLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ When you have a comestible you want to add to the files, just go down this list,

`alcohol.json` -- "Drink" comestible with alcohol addiction
`soup.json` -- "Drink" comestible which is a soup. This is more of a "food" than a drink - you primarily want the calories from this
`drinks.json` -- "Drink" comestible. This is your drink of choice when you're thirsty! examples: tea, juice, water
`drink.json` -- "Drink" comestible. This is your drink of choice when you're thirsty! examples: tea, juice, water
`drink_other.json` -- "Drink" comestible that does not fit any other criteria. example: vinegar, mustard

`junkfood.json` -- comestible with the "junk" material. examples: cake, sugary cereal, nachos
Expand All @@ -36,5 +36,5 @@ When you have a comestible you want to add to the files, just go down this list,
`egg.json` -- either an egg, or made of egg
`dairy.json` -- made of milk
`mushroom.json` -- a mushroom or made of mushrooms
`nut.json` -- a nut or made of nuts
`nuts.json` -- a nut or made of nuts
`other.json` -- if you made it here, your comestible doesn't fit any other category!
2 changes: 1 addition & 1 deletion data/json/furniture.json
Original file line number Diff line number Diff line change
Expand Up @@ -2264,7 +2264,7 @@
"type": "furniture",
"id": "f_lily",
"name": "lily",
"looks_like": "f_tulip",
"looks_like": "f_flower_tulip",
"symbol": "f",
"color": "magenta",
"move_cost_mod": 0,
Expand Down
12 changes: 7 additions & 5 deletions data/json/items/comestibles/drink.json
Original file line number Diff line number Diff line change
Expand Up @@ -210,19 +210,21 @@
"id": "con_milk",
"name": "condensed milk",
"name_plural": "condensed milk",
"weight": 258,
"weight": 32,
"color": "white",
"spoils_in": "1 day",
"container": "can_food",
"comestible_type": "DRINK",
"symbol": "~",
"quench": 20,
"calories": 95,
"description": "Baby cow food, appropriated for adult humans. Having been canned, this milk should last for a very long time.",
"price": 700,
"quench": 12,
"calories": 103,
"description": "Baby cow food, appropriated for adult humans. This milk has been sweetened and thickened, making it a sweet addition to any food.",
"price": 70,
"material": [ "milk", "junk" ],
"volume": 1,
"phase": "liquid",
"charges": 10,
"vitamins": [ [ "calcium", 2 ] ],
"fun": 3
},
{
Expand Down
2 changes: 1 addition & 1 deletion data/json/items/comestibles/mutagen.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"stim": -5,
"addiction_potential": 6,
"container": "test_tube",
"tool": "syringe"
"tools_needed": "syringe"
},
{
"id": "iv_mutagen",
Expand Down
6 changes: 3 additions & 3 deletions data/json/monsters.json
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@
"vision_night": 3,
"harvest": "mr_bones",
"special_attacks": [ { "type": "bite", "cooldown": 5 } ],
"death_function": [ "NORMAL", "SPLATTER" ],
"death_function": [ "NORMAL" ],
"flags": [ "SEES", "HEARS", "NO_BREATHE", "HARDTOSHOOT", "REVIVES", "POISON", "FILTHY" ]
},
{
Expand Down Expand Up @@ -2361,7 +2361,7 @@
"special_attacks": [ [ "scratch", 10 ], { "type": "bite", "cooldown": 5 } ],
"upgrades": { "half_life": 15, "into": "mon_skeleton_hulk" },
"death_drops": "default_zombie_clothes",
"death_function": [ "NORMAL", "SPLATTER" ],
"death_function": [ "NORMAL" ],
"flags": [ "SEES", "HEARS", "BLEED", "HARDTOSHOOT", "REVIVES", "NO_BREATHE", "POISON", "FILTHY" ]
},
{
Expand Down Expand Up @@ -4961,7 +4961,7 @@
"special_attacks": [ [ "SMASH", 20 ], [ "STRETCH_ATTACK", 20 ], [ "LONGSWIPE", 20 ],
{ "id": "scratch", "damage_max_instance": [ { "damage_type": "cut", "amount": 23, "armor_multiplier": 0.8 } ] } ],
"death_drops": "mon_zombie_hulk_death_drops",
"death_function": [ "NORMAL", "SPLATTER" ],
"death_function": [ "NORMAL" ],
"burn_into": "mon_zombie_fiend",
"flags": [
"SEES",
Expand Down
31 changes: 20 additions & 11 deletions src/crafting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -775,35 +775,44 @@ comp_selection<item_comp> player::select_item_component( const std::vector<item_
for( const auto &component : components ) {
itype_id type = component.type;
int count = ( component.count > 0 ) ? component.count * batch : abs( component.count );
bool pl = false;
bool mp = false;
bool found = false;

if( item::count_by_charges( type ) && count > 0 ) {
if( has_charges( type, count ) ) {
long map_charges = map_inv.charges_of( type );

// If map has infinite charges, just use them
if( map_charges == item::INFINITE_CHARGES ) {
selected.use_from = use_from_map;
selected.comp = component;
return selected;
}

long player_charges = charges_of( type );

if( player_charges >= count ) {
player_has.push_back( component );
pl = true;
found = true;
}
if( map_inv.has_charges( type, count ) ) {
if( map_charges >= count ) {
map_has.push_back( component );
mp = true;
found = true;
}
if( !pl && !mp && charges_of( type ) + map_inv.charges_of( type ) >= count ) {
if( !found && player_charges + map_charges >= count ) {
mixed.push_back( component );
}
} else { // Counting by units, not charges

if( has_amount( type, count ) ) {
player_has.push_back( component );
pl = true;
found = true;
}
if( map_inv.has_components( type, count ) ) {
map_has.push_back( component );
mp = true;
found = true;
}
if( !pl && !mp && amount_of( type ) + map_inv.amount_of( type ) >= count ) {
if( !found && amount_of( type ) + map_inv.amount_of( type ) >= count ) {
mixed.push_back( component );
}

}
}

Expand Down
3 changes: 2 additions & 1 deletion src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3371,7 +3371,8 @@ void game::disp_kills()
for( const auto &entry : kill_counts ) {
std::ostringstream buffer;
buffer << "<color_" << std::get<2>( entry.first ) << ">";
buffer << std::get<1>( entry.first ) << "</color>" << " " << std::get<0>( entry.first );
buffer << std::get<1>( entry.first ) << "</color>" << " ";
buffer << "<color_light_gray>" << std::get<0>( entry.first ) << "</color>";
const int w = colum_width - utf8_width( std::get<0>( entry.first ) );
buffer.width( w - 3 ); // gap between cols, monster sym, space
buffer.fill( ' ' );
Expand Down
10 changes: 10 additions & 0 deletions src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4758,6 +4758,9 @@ std::list<item> map::use_charges( const tripoint &origin, const int range,
const itype_id type, long &quantity )
{
std::list<item> ret;

// We prefer infinite map sources where available, so search for those
// first
for( const tripoint &p : closest_tripoints_first( range, origin ) ) {
// can not reach this -> can not access its contents
if( origin != p && !clear_path( origin, p, range, 1, 100 ) ) {
Expand All @@ -4771,6 +4774,13 @@ std::list<item> map::use_charges( const tripoint &origin, const int range,
quantity = 0;
return ret;
}
}

for( const tripoint &p : closest_tripoints_first( range, origin ) ) {
// can not reach this -> can not access its contents
if( origin != p && !clear_path( origin, p, range, 1, 100 ) ) {
continue;
}

if( has_furn( p ) ) {
use_charges_from_furn( furn( p ).obj(), type, quantity, this, p, ret );
Expand Down
8 changes: 5 additions & 3 deletions src/mondeath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ void scatter_chunks( std::string chunk_name, int chunk_amt, monster &z, int dist
{
// can't have less than one item in a pile or it would cause an infinite loop
pile_size = std::max( pile_size, 1 );
// can't have more items in a pile than total items
pile_size = std::min( chunk_amt, pile_size );
distance = abs( distance );
const item chunk( chunk_name, calendar::turn, pile_size );
for( int i = 0; i < chunk_amt; i += pile_size ) {
Expand Down Expand Up @@ -182,9 +184,9 @@ void mdeath::splatter( monster &z )
// only flesh and bones survive.
if( entry.type == "flesh" || entry.type == "bone" ) {
// the larger the overflow damage, the less you get
scatter_chunks( entry.drop, ( entry.mass_ratio / overflow_ratio / 10 * to_gram(
z.get_weight() ) ) / to_gram( ( item::find_type( entry.drop ) )->weight ), z, gib_distance,
to_gram( ( item::find_type( entry.drop ) )->weight ) / ( gib_distance - 1 ) );
const int chunk_amt = entry.mass_ratio / overflow_ratio / 10 * to_gram(
z.get_weight() ) / to_gram( ( item::find_type( entry.drop ) )->weight );
scatter_chunks( entry.drop, chunk_amt, z, gib_distance, chunk_amt / ( gib_distance - 1 ) );
gibbed_weight -= entry.mass_ratio / overflow_ratio / 20 * to_gram( z.get_weight() );
}
}
Expand Down

0 comments on commit 7c6ef21

Please sign in to comment.