Skip to content

Commit

Permalink
feat: Allow mutant-spawned liquids to be stored/consumed (#5877)
Browse files Browse the repository at this point in the history
* Allow mutant-spawned liquids to be stored/consumed

Basically just ports the change Vollch made to spells spawning items

* style(autofix.ci): automated formatting

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
RobbieNeko and autofix-ci[bot] authored Jan 5, 2025
1 parent c8491de commit 3c04084
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/mutation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
#include "event_bus.h"
#include "field_type.h"
#include "game.h"
#include "handle_liquid.h"
#include "item.h"
#include "item_contents.h"
#include "itype.h"
Expand Down Expand Up @@ -583,7 +584,12 @@ void Character::activate_mutation( const trait_id &mut )
return;
}
} else if( !mdata.spawn_item.is_empty() ) {
i_add_or_drop( item::spawn( mdata.spawn_item ) );
detached_ptr<item> granted = item::spawn( mdata.spawn_item );
if( granted->made_of( LIQUID ) ) {
liquid_handler::consume_liquid( std::move( granted ), 1 );
} else {
i_add_or_drop( std::move( granted ) );
}
add_msg_if_player( mdata.spawn_item_message() );
tdata.powered = false;
return;
Expand Down

0 comments on commit 3c04084

Please sign in to comment.