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"
@@ -4919,6 +4920,7 @@ void item::on_contents_changed()
49194920
49204921void item::on_damage ( int qty, damage_type )
49214922{
4923+ proc::apply_on_damage ( *this , qty );
49224924 if ( is_corpse () && qty + damage_ >= max_damage () ) {
49234925 set_flag ( flag_PULPED );
49244926 }
@@ -5430,6 +5432,14 @@ units::mass item::weight( bool include_contents, bool integral ) const
54305432 return ret;
54315433 }
54325434
5435+ if ( const auto mass = proc::blob_mass ( *this ) ) {
5436+ auto ret = units::from_gram ( *mass );
5437+ if ( include_contents ) {
5438+ ret += contents.item_weight_modifier ();
5439+ }
5440+ return ret;
5441+ }
5442+
54335443 units::mass ret;
54345444 std::string local_str_mass = integral ? get_var ( " integral_weight" ) : get_var ( " weight" );
54355445 if ( local_str_mass.empty () ) {
@@ -5557,6 +5567,10 @@ units::volume item::base_volume() const
55575567 }
55585568 }
55595569
5570+ if ( const auto proc_volume = proc::blob_volume ( *this ) ) {
5571+ return units::from_milliliter ( *proc_volume );
5572+ }
5573+
55605574 return type->volume ;
55615575}
55625576
@@ -5578,6 +5592,10 @@ units::volume item::volume( bool integral ) const
55785592 return ret;
55795593 }
55805594
5595+ if ( const auto proc_volume = proc::blob_volume ( *this ) ) {
5596+ return units::from_milliliter ( *proc_volume );
5597+ }
5598+
55815599 const int local_volume = get_var ( " volume" , -1 );
55825600 units::volume ret;
55835601 if ( local_volume >= 0 ) {
@@ -9923,6 +9941,10 @@ std::string item::components_to_string() const
99239941
99249942uint64_t item::make_component_hash () const
99259943{
9944+ if ( const auto hash = proc::component_hash ( *this ) ) {
9945+ return *hash;
9946+ }
9947+
99269948 // First we need to sort the IDs so that identical ingredients give identical hashes.
99279949 std::multiset<std::string> id_set;
99289950 for ( const item * const &it : components ) {
@@ -11230,6 +11252,21 @@ int item::get_min_str() const
1123011252std::vector<item_comp> item::get_uncraft_components () const
1123111253{
1123211254 std::vector<item_comp> ret;
11255+ if ( const auto payload = proc::read_payload ( *this ); payload &&
11256+ payload->mode == proc::hist::compact ) {
11257+ std::ranges::for_each ( payload->parts , [&]( const proc::compact_part & part ) {
11258+ auto iter = std::ranges::find_if ( ret, [&]( item_comp & obj ) {
11259+ return obj.type == part.id ;
11260+ } );
11261+ if ( iter != ret.end () ) {
11262+ iter->count += part.n ;
11263+ } else {
11264+ ret.emplace_back ( part.id , part.n );
11265+ }
11266+ } );
11267+ return ret;
11268+ }
11269+
1123311270 if ( components.empty () ) {
1123411271 // If item wasn't crafted with specific components use default recipe
1123511272 std::vector<std::vector<item_comp>> recipe = recipe_dictionary::get_uncraft (
0 commit comments