Skip to content

Commit

Permalink
fix: don't try to bleed corpses that lack blood, remove rotten decay …
Browse files Browse the repository at this point in the history
…results, blood dumped on the ground becomes a field (#4879)
  • Loading branch information
chaosvolt authored Jun 24, 2024
1 parent d646b44 commit fc56997
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
6 changes: 6 additions & 0 deletions data/json/emit.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@
"chance": 1,
"qty": 25
},
{
"id": "emit_drop_blood",
"type": "emit",
"field": "fd_blood",
"intensity": 1
},
{
"id": "emit_acid_splash",
"type": "emit",
Expand Down
3 changes: 2 additions & 1 deletion data/json/items/comestibles/carnivore.json
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,8 @@
"material": "hflesh",
"volume": "250 ml",
"phase": "liquid",
"fun": -50
"fun": -50,
"drop_action": { "type": "emit_actor", "emits": [ "emit_drop_blood" ], "scale_qty": true }
},
{
"type": "COMESTIBLE",
Expand Down
10 changes: 8 additions & 2 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8231,6 +8231,7 @@ static void butcher_submenu( const std::vector<item *> &corpses, int corpse = -1
};
const bool enough_light = character_funcs::can_see_fine_details( you );

bool has_blood = false;
bool has_skin = false;
bool has_organs = false;

Expand All @@ -8248,6 +8249,9 @@ static void butcher_submenu( const std::vector<item *> &corpses, int corpse = -1
const mtype *dead_mon = it->get_mtype();
if( dead_mon != nullptr ) {
for( const harvest_entry &entry : dead_mon->harvest.obj() ) {
if( entry.type == "blood" ) {
has_blood = true;
}
if( entry.type == "skin" ) {
has_skin = true;
}
Expand Down Expand Up @@ -8282,8 +8286,10 @@ static void butcher_submenu( const std::vector<item *> &corpses, int corpse = -1
"(for ex. a table, a leather tarp, etc.). "
"Yields are plentiful and varied, but it is time consuming." ),
msg_inv, info_on_action( BUTCHER_FULL ).c_str() ) );
smenu.addentry_col( BLEED, enough_light, 'l', _( "Bleed corpse" ),
enough_light ? cut_time( BLEED ) : cannot_see,
smenu.addentry_col( BLEED, enough_light &&
has_blood, 'l', _( "Bleed corpse" ),
enough_light ? ( has_blood ? cut_time( BLEED ) : colorize( _( "has no blood" ),
c_red ) ) : cannot_see,
string_format( "%s %s%s",
_( "Bleeding involves severing the carotid arteries and jugular "
"veins, or the blood vessels from which they arise. "
Expand Down
5 changes: 3 additions & 2 deletions src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7319,8 +7319,9 @@ void map::handle_decayed_corpse( const item &it, const tripoint &pnt )
if( harvest->charges > 1 ) {
harvest->charges = 1;
}

add_item_or_charges( pnt, item::spawn( *harvest ) );
if( !harvest->rotten() ) {
add_item_or_charges( pnt, item::spawn( *harvest ) );
}
}
}
}
Expand Down

0 comments on commit fc56997

Please sign in to comment.