8585#include " overmapbuffer.h"
8686#include " pimpl.h"
8787#include " player.h"
88+ #include " proc_item.h"
8889#include " player_activity.h"
8990#include " pldata.h"
9091#include " point.h"
@@ -4956,6 +4957,7 @@ void item::on_contents_changed()
49564957
49574958void item::on_damage ( int qty, damage_type )
49584959{
4960+ proc::apply_on_damage ( *this , qty );
49594961 if ( is_corpse () && qty + damage_ >= max_damage () ) {
49604962 set_flag ( flag_PULPED );
49614963 }
@@ -5467,6 +5469,14 @@ units::mass item::weight( bool include_contents, bool integral ) const
54675469 return ret;
54685470 }
54695471
5472+ if ( const auto mass = proc::blob_mass ( *this ) ) {
5473+ auto ret = units::from_gram ( *mass );
5474+ if ( include_contents ) {
5475+ ret += contents.item_weight_modifier ();
5476+ }
5477+ return ret;
5478+ }
5479+
54705480 units::mass ret;
54715481 std::string local_str_mass = integral ? get_var ( " integral_weight" ) : get_var ( " weight" );
54725482 if ( local_str_mass.empty () ) {
@@ -5594,6 +5604,10 @@ units::volume item::base_volume() const
55945604 }
55955605 }
55965606
5607+ if ( const auto proc_volume = proc::blob_volume ( *this ) ) {
5608+ return units::from_milliliter ( *proc_volume );
5609+ }
5610+
55975611 return type->volume ;
55985612}
55995613
@@ -5615,6 +5629,10 @@ units::volume item::volume( bool integral ) const
56155629 return ret;
56165630 }
56175631
5632+ if ( const auto proc_volume = proc::blob_volume ( *this ) ) {
5633+ return units::from_milliliter ( *proc_volume );
5634+ }
5635+
56185636 const int local_volume = get_var ( " volume" , -1 );
56195637 units::volume ret;
56205638 if ( local_volume >= 0 ) {
@@ -10015,6 +10033,10 @@ std::string item::components_to_string() const
1001510033
1001610034uint64_t item::make_component_hash () const
1001710035{
10036+ if ( const auto hash = proc::component_hash ( *this ) ) {
10037+ return *hash;
10038+ }
10039+
1001810040 // First we need to sort the IDs so that identical ingredients give identical hashes.
1001910041 std::multiset<std::string> id_set;
1002010042 for ( const item * const &it : components ) {
@@ -11322,6 +11344,21 @@ int item::get_min_str() const
1132211344std::vector<item_comp> item::get_uncraft_components () const
1132311345{
1132411346 std::vector<item_comp> ret;
11347+ if ( const auto payload = proc::read_payload ( *this ); payload &&
11348+ payload->mode == proc::hist::compact ) {
11349+ std::ranges::for_each ( payload->parts , [&]( const proc::compact_part & part ) {
11350+ auto iter = std::ranges::find_if ( ret, [&]( item_comp & obj ) {
11351+ return obj.type == part.id ;
11352+ } );
11353+ if ( iter != ret.end () ) {
11354+ iter->count += part.n ;
11355+ } else {
11356+ ret.emplace_back ( part.id , part.n );
11357+ }
11358+ } );
11359+ return ret;
11360+ }
11361+
1132511362 if ( components.empty () ) {
1132611363 // If item wasn't crafted with specific components use default recipe
1132711364 std::vector<std::vector<item_comp>> recipe = recipe_dictionary::get_uncraft (
0 commit comments