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

feat(content,port): corpses decay into items, use existing harvest entries to actually implement feature, fix off-map decay behavior #4751

Merged
Show file tree
Hide file tree
Changes from 12 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
62 changes: 31 additions & 31 deletions data/json/harvest.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@
{ "drop": "lung", "type": "flesh", "mass_ratio": 0.0035 },
{ "drop": "liver", "type": "offal", "mass_ratio": 0.01 },
{ "drop": "brain", "type": "flesh", "mass_ratio": 0.005 },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "raw_fur", "type": "skin", "mass_ratio": 0.13 },
{ "drop": "fat", "type": "flesh", "mass_ratio": 0.07 }
]
Expand All @@ -129,8 +129,8 @@
{ "drop": "sweetbread", "type": "flesh", "mass_ratio": 0.002 },
{ "drop": "kidney", "type": "offal", "mass_ratio": 0.002 },
{ "drop": "stomach", "scale_num": [ 1, 1 ], "max": 1, "type": "offal" },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "raw_fur", "type": "skin", "mass_ratio": 0.08 },
{ "drop": "fat", "type": "flesh", "mass_ratio": 0.075 }
]
Expand All @@ -148,8 +148,8 @@
{ "drop": "sweetbread", "type": "flesh", "mass_ratio": 0.002 },
{ "drop": "kidney", "type": "offal", "mass_ratio": 0.002 },
{ "drop": "stomach_large", "scale_num": [ 1, 1 ], "max": 1, "type": "offal" },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "raw_fur", "type": "skin", "mass_ratio": 0.04 },
{ "drop": "fat", "type": "flesh", "mass_ratio": 0.07 }
]
Expand All @@ -161,8 +161,8 @@
"entries": [
{ "drop": "mutant_human_flesh", "type": "flesh", "mass_ratio": 0.34 },
{ "drop": "hstomach", "scale_num": [ 1, 1 ], "max": 1, "type": "offal" },
{ "drop": "bone_human", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone_human", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "raw_hfur", "type": "skin", "mass_ratio": 0.02 },
{ "drop": "mutant_human_fat", "type": "flesh", "mass_ratio": 0.07 }
]
Expand All @@ -175,8 +175,8 @@
{ "drop": "cyborg_harvest_uncommon", "type": "bionic_group", "faults": [ "fault_bionic_nonsterile" ] },
{ "drop": "mutant_human_flesh", "type": "flesh", "mass_ratio": 0.34 },
{ "drop": "hstomach", "scale_num": [ 1, 1 ], "max": 1, "type": "offal" },
{ "drop": "bone_human", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone_human", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "raw_hfur", "type": "skin", "mass_ratio": 0.02 },
{ "drop": "mutant_human_fat", "type": "flesh", "mass_ratio": 0.07 }
]
Expand All @@ -188,8 +188,8 @@
"entries": [
{ "drop": "mutant_human_flesh", "type": "flesh", "mass_ratio": 0.34 },
{ "drop": "hstomach_large", "scale_num": [ 1, 1 ], "max": 1, "type": "offal" },
{ "drop": "bone_human", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone_human", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "raw_hfur", "type": "skin", "mass_ratio": 0.02 },
{ "drop": "mutant_human_fat", "type": "flesh", "mass_ratio": 0.07 }
]
Expand All @@ -202,8 +202,8 @@
{ "drop": "cyborg_harvest_uncommon", "type": "bionic_group", "faults": [ "fault_bionic_nonsterile" ] },
{ "drop": "mutant_human_flesh", "type": "flesh", "mass_ratio": 0.34 },
{ "drop": "hstomach_large", "scale_num": [ 1, 1 ], "max": 1, "type": "offal" },
{ "drop": "bone_human", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone_human", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "raw_hfur", "type": "skin", "mass_ratio": 0.02 },
{ "drop": "mutant_human_fat", "type": "flesh", "mass_ratio": 0.07 }
]
Expand All @@ -218,8 +218,8 @@
{ "drop": "lung", "type": "flesh", "mass_ratio": 0.0035 },
{ "drop": "liver", "type": "offal", "mass_ratio": 0.01 },
{ "drop": "brain", "type": "flesh", "mass_ratio": 0.005 },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "raw_leather", "type": "skin", "mass_ratio": 0.13 },
{ "drop": "fat", "type": "flesh", "mass_ratio": 0.07 }
]
Expand All @@ -233,8 +233,8 @@
{ "drop": "mutant_meat_scrap", "type": "flesh", "mass_ratio": 0.05 },
{ "drop": "brain", "type": "flesh", "mass_ratio": 0.005 },
{ "drop": "mutant_offal", "type": "offal", "mass_ratio": 0.01 },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "raw_fur", "type": "skin", "mass_ratio": 0.02 },
{ "drop": "mutant_fat", "type": "flesh", "mass_ratio": 0.07 }
]
Expand All @@ -252,8 +252,8 @@
{ "drop": "sweetbread", "type": "flesh", "mass_ratio": 0.002 },
{ "drop": "kidney", "type": "offal", "mass_ratio": 0.002 },
{ "drop": "stomach", "scale_num": [ 1, 1 ], "max": 1, "type": "offal" },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "raw_leather", "type": "skin", "mass_ratio": 0.08 },
{ "drop": "fat", "type": "flesh", "mass_ratio": 0.07 }
]
Expand All @@ -268,8 +268,8 @@
{ "drop": "brain", "type": "flesh", "mass_ratio": 0.005 },
{ "drop": "mutant_offal", "type": "offal", "mass_ratio": 0.01 },
{ "drop": "stomach", "scale_num": [ 1, 1 ], "max": 1, "type": "offal" },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "raw_leather", "type": "skin", "mass_ratio": 0.02 },
{ "drop": "mutant_fat", "type": "flesh", "mass_ratio": 0.07 }
]
Expand All @@ -287,8 +287,8 @@
{ "drop": "sweetbread", "type": "flesh", "mass_ratio": 0.002 },
{ "drop": "kidney", "type": "offal", "mass_ratio": 0.002 },
{ "drop": "stomach_large", "scale_num": [ 1, 1 ], "max": 1, "type": "offal" },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "raw_leather", "type": "skin", "mass_ratio": 0.04 },
{ "drop": "fat", "type": "flesh", "mass_ratio": 0.07 }
]
Expand All @@ -303,8 +303,8 @@
{ "drop": "brain", "type": "flesh", "mass_ratio": 0.005 },
{ "drop": "mutant_offal", "type": "offal", "mass_ratio": 0.01 },
{ "drop": "stomach", "scale_num": [ 1, 1 ], "max": 1, "type": "offal" },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "raw_fur", "type": "skin", "mass_ratio": 0.02 },
{ "drop": "mutant_fat", "type": "flesh", "mass_ratio": 0.07 }
]
Expand All @@ -322,8 +322,8 @@
{ "drop": "sweetbread", "type": "flesh", "mass_ratio": 0.002 },
{ "drop": "kidney", "type": "offal", "mass_ratio": 0.002 },
{ "drop": "stomach_large", "scale_num": [ 1, 1 ], "max": 1, "type": "offal" },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "raw_leather", "type": "skin", "mass_ratio": 0.04 },
{ "drop": "mutant_fat", "type": "flesh", "mass_ratio": 0.07 }
]
Expand Down Expand Up @@ -357,8 +357,8 @@
{ "drop": "sweetbread", "type": "flesh", "mass_ratio": 0.002 },
{ "drop": "kidney", "type": "offal", "mass_ratio": 0.002 },
{ "drop": "stomach_large", "scale_num": [ 1, 1 ], "max": 1, "type": "offal" },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "wool_staple", "type": "skin", "mass_ratio": 0.04 },
{ "drop": "fat", "type": "flesh", "mass_ratio": 0.07 }
]
Expand All @@ -373,8 +373,8 @@
{ "drop": "brain", "type": "flesh", "mass_ratio": 0.005 },
{ "drop": "mutant_offal", "type": "offal", "mass_ratio": 0.01 },
{ "drop": "stomach_large", "scale_num": [ 1, 1 ], "max": 1, "type": "offal" },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.2 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.2 },
{ "drop": "mutant_fat", "type": "flesh", "mass_ratio": 0.07 },
{ "drop": "chitin_piece", "type": "skin", "mass_ratio": 0.1 }
]
Expand All @@ -389,8 +389,8 @@
{ "drop": "brain", "type": "flesh", "mass_ratio": 0.005 },
{ "drop": "mutant_offal", "type": "offal", "mass_ratio": 0.01 },
{ "drop": "stomach_large", "scale_num": [ 1, 1 ], "max": 1, "type": "offal" },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "raw_fur", "type": "skin", "mass_ratio": 0.02 },
{ "drop": "mutant_fat", "type": "flesh", "mass_ratio": 0.07 }
]
Expand All @@ -408,8 +408,8 @@
{ "drop": "sweetbread", "type": "flesh", "mass_ratio": 0.002 },
{ "drop": "kidney", "type": "offal", "mass_ratio": 0.002 },
{ "drop": "stomach", "scale_num": [ 1, 1 ], "max": 1, "type": "offal" },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "fat", "type": "flesh", "mass_ratio": 0.07 }
]
},
Expand All @@ -426,8 +426,8 @@
{ "drop": "sweetbread", "type": "flesh", "mass_ratio": 0.002 },
{ "drop": "kidney", "type": "offal", "mass_ratio": 0.002 },
{ "drop": "stomach_large", "scale_num": [ 1, 1 ], "max": 1, "type": "offal" },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "fat", "type": "flesh", "mass_ratio": 0.07 }
]
},
Expand All @@ -444,8 +444,8 @@
{ "drop": "sweetbread", "type": "flesh", "mass_ratio": 0.002 },
{ "drop": "kidney", "type": "offal", "mass_ratio": 0.002 },
{ "drop": "stomach_large", "scale_num": [ 1, 1 ], "max": 1, "type": "offal" },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "mutant_fat", "type": "flesh", "mass_ratio": 0.07 }
]
},
Expand Down Expand Up @@ -529,8 +529,8 @@
{ "drop": "mutant_meat", "type": "flesh", "mass_ratio": 0.2 },
{ "drop": "meat_scrap", "type": "flesh", "mass_ratio": 0.1 },
{ "drop": "stomach", "scale_num": [ 0, 1 ], "max": 1, "type": "offal" },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 }
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone", "type": "bone", "mass_ratio": 0.15 }
]
},
{
Expand Down Expand Up @@ -784,8 +784,8 @@
"//": "spooky scary skeletons",
"type": "harvest",
"entries": [
{ "drop": "bone_tainted", "type": "flesh", "mass_ratio": 0.5 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 }
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone_tainted", "type": "flesh", "mass_ratio": 0.5 }
]
},
{
Expand All @@ -796,8 +796,8 @@
{ "drop": "human_flesh", "type": "flesh", "mass_ratio": 0.2 },
{ "drop": "hstomach", "scale_num": [ 1, 1 ], "max": 1, "type": "offal" },
{ "drop": "human_fat", "type": "flesh", "mass_ratio": 0.1 },
{ "drop": "bone_human", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone_human", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "raw_hleather", "type": "skin", "mass_ratio": 0.03 }
]
},
Expand All @@ -808,8 +808,8 @@
{ "drop": "mutant_human_flesh", "type": "flesh", "mass_ratio": 0.2 },
{ "drop": "hstomach", "scale_num": [ 1, 1 ], "max": 1, "type": "offal" },
{ "drop": "mutant_human_fat", "type": "flesh", "mass_ratio": 0.1 },
{ "drop": "bone_human", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone_human", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "raw_hleather", "type": "skin", "mass_ratio": 0.03 }
]
},
Expand All @@ -821,8 +821,8 @@
{ "drop": "meat", "type": "flesh", "mass_ratio": 0.4 },
{ "drop": "hstomach", "scale_num": [ 1, 1 ], "max": 1, "type": "offal" },
{ "drop": "human_fat", "type": "flesh", "mass_ratio": 0.1 },
{ "drop": "bone_human", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone_human", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "raw_leather", "type": "skin", "mass_ratio": 0.03 },
{ "drop": "raw_fur", "type": "skin", "mass_ratio": 0.001 }
]
Expand Down Expand Up @@ -876,8 +876,8 @@
{ "drop": "human_flesh", "type": "flesh", "mass_ratio": 0.2 },
{ "drop": "hstomach", "scale_num": [ 1, 1 ], "max": 1, "type": "offal" },
{ "drop": "human_fat", "type": "flesh", "mass_ratio": 0.1 },
{ "drop": "bone_human", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone_human", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "raw_hleather", "type": "skin", "mass_ratio": 0.03 }
]
},
Expand Down Expand Up @@ -911,8 +911,8 @@
{ "drop": "human_flesh", "type": "flesh", "mass_ratio": 0.2 },
{ "drop": "hstomach", "scale_num": [ 1, 1 ], "max": 1, "type": "offal" },
{ "drop": "human_fat", "type": "flesh", "mass_ratio": 0.1 },
{ "drop": "bone_human", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone_human", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "raw_hleather", "type": "skin", "mass_ratio": 0.03 }
]
},
Expand All @@ -935,8 +935,8 @@
{ "drop": "human_flesh", "type": "flesh", "mass_ratio": 0.2 },
{ "drop": "hstomach", "scale_num": [ 1, 1 ], "max": 1, "type": "offal" },
{ "drop": "human_fat", "type": "flesh", "mass_ratio": 0.1 },
{ "drop": "bone_human", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone_human", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "raw_hleather", "type": "skin", "mass_ratio": 0.03 }
]
},
Expand Down Expand Up @@ -981,8 +981,8 @@
{ "drop": "human_flesh", "type": "flesh", "mass_ratio": 0.2 },
{ "drop": "hstomach", "scale_num": [ 1, 1 ], "max": 1, "type": "offal" },
{ "drop": "human_fat", "type": "flesh", "mass_ratio": 0.1 },
{ "drop": "bone_human", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "sinew", "type": "bone", "mass_ratio": 0.001 },
{ "drop": "bone_human", "type": "bone", "mass_ratio": 0.15 },
{ "drop": "raw_hleather", "type": "skin", "mass_ratio": 0.03 }
]
},
Expand Down
14 changes: 11 additions & 3 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9916,11 +9916,14 @@ detached_ptr<item> item::process_internal( detached_ptr<item> &&self, player *ca
}
// All foods that go bad have temperature
if( ( self->is_food() || self->is_corpse() ) ) {
bool comestible = self->is_comestible();
item &obj = *self;
self = process_rot( std::move( self ), seals, pos, carrier, flag, weather_generator );
if( comestible && !self ) {
here.rotten_item_spawn( obj, pos );
if( !self ) {
if( obj.is_comestible() ) {
here.rotten_item_spawn( obj, pos );
} else if( obj.is_corpse() ) {
here.handle_decayed_corpse( obj, pos );
}
}
}
return std::move( self );
Expand Down Expand Up @@ -10124,6 +10127,11 @@ std::string item::type_name( unsigned int quantity ) const
return ret_name;
}

const mtype *item::get_corpse_mon() const
{
return corpse;
}

std::string item::get_corpse_name()
{
if( corpse_name.empty() ) {
Expand Down
1 change: 1 addition & 0 deletions src/item.h
Original file line number Diff line number Diff line change
Expand Up @@ -2325,6 +2325,7 @@ class item : public location_visitable<item>, public game_object<item>
void add_component( detached_ptr<item> &&comp );
const location_vector<item> &get_components() const;
location_vector<item> &get_components();
const mtype *get_corpse_mon() const;
private:
location_vector<item> components;
const itype *curammo = nullptr;
Expand Down
48 changes: 45 additions & 3 deletions src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7263,14 +7263,56 @@ void map::loadn( const tripoint &grid, const bool update_vehicles )
template <typename Container>
void map::remove_rotten_items( Container &items, const tripoint &pnt, temperature_flag temperature )
{
items.remove_with( [this, &pnt, &temperature]( detached_ptr<item> &&it ) {
std::vector<item *> corpses_handle;
items.remove_with( [this, &pnt, &temperature, &corpses_handle]( detached_ptr<item> &&it ) {
item &obj = *it;
it = item::actualize_rot( std::move( it ), pnt, temperature, get_weather() );
if( !it && obj.is_comestible() ) {
rotten_item_spawn( obj, pnt );
// When !it, that means the item was removed from the world, ie: has rotted.
if( !it ) {
if( obj.is_comestible() ) {
rotten_item_spawn( obj, pnt );
} else if( obj.is_corpse() ) {
corpses_handle.push_back( &obj );
}
}
return std::move( it );
} );

for( const item *corpse : corpses_handle ) {
handle_decayed_corpse( *corpse, pnt );
}

}

void map::handle_decayed_corpse( const item &it, const tripoint &pnt )
{
const mtype *dead_monster = it.get_corpse_mon();
if( !dead_monster ) {
debugmsg( "Corpse at tripoint %s has no associated monster?!", getglobal( pnt ).to_string() );
return;
}

int decayed_weight_grams = to_gram( dead_monster->weight ); // corpse might have stuff in it!
decayed_weight_grams *= rng_float( 0.5, 0.9 );

for( const harvest_entry &entry : dead_monster->harvest.obj() ) {
if( entry.type != "bionic" && entry.type != "bionic_group" ) {
detached_ptr<item> harvest = item::spawn( entry.drop, it.birthday() );
const float random_decay_modifier = rng_float( 0.0f, static_cast<float>( MAX_SKILL ) );
const float min_num = entry.scale_num.first * random_decay_modifier + entry.base_num.first;
const float max_num = entry.scale_num.second * random_decay_modifier + entry.base_num.second;
int roll = 0;
if( entry.mass_ratio != 0.00f ) {
roll = static_cast<int>( std::round( entry.mass_ratio * decayed_weight_grams ) );
roll = std::ceil( static_cast<double>( roll ) / to_gram( harvest->weight() ) );
} else {
roll = std::min<int>( entry.max, std::round( rng_float( min_num, max_num ) ) );
}
for( int i = 0; i < roll; i++ ) {
add_item_or_charges( pnt, item::spawn( *harvest ) );
}
}
}
}

void map::rotten_item_spawn( const item &item, const tripoint &pnt )
Expand Down
Loading
Loading