diff --git a/data/json/furniture_and_terrain/terrain-manufactured.json b/data/json/furniture_and_terrain/terrain-manufactured.json index b418c6274f253..0ac1cd1087c0e 100644 --- a/data/json/furniture_and_terrain/terrain-manufactured.json +++ b/data/json/furniture_and_terrain/terrain-manufactured.json @@ -519,7 +519,7 @@ "move_cost": 0, "coverage": 40, "roof": "t_flat_roof", - "flags": [ "TRANSPARENT", "SEALED", "PLACE_ITEM", "WALL" ], + "flags": [ "TRANSPARENT", "SEALED", "PLACE_ITEM", "WALL", "NO_SPOIL" ], "bash": { "str_min": 2, "str_max": 80, diff --git a/doc/JSON_FLAGS.md b/doc/JSON_FLAGS.md index a1fc3aa9b05f1..c69ab006cc8f1 100644 --- a/doc/JSON_FLAGS.md +++ b/doc/JSON_FLAGS.md @@ -566,6 +566,7 @@ List of known flags, used in both `terrain.json` and `furniture.json`. - ```NO_SIGHT``` Creature on this tile have their sight reduced to one tile - ```NO_SCENT``` This tile cannot have scent values, which prevents scent diffusion through this tile - ```NO_SHOOT``` Terrain with this flag cannot be damaged by ranged attacks, and ranged attacks will not pass through it. +- ```NO_SPOIL``` Items placed in this tile do not spoil. - ```OPENCLOSE_INSIDE``` If it's a door (with an 'open' or 'close' field), it can only be opened or closed if you're inside. - ```PAINFUL``` May cause a small amount of pain. - ```PERMEABLE``` Permeable for gases. diff --git a/src/map.cpp b/src/map.cpp index ebedcdf893857..4663a4bf4984b 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -4595,9 +4595,10 @@ void map::update_lum( item_location &loc, bool add ) } static bool process_map_items( item_stack &items, safe_reference &item_ref, - const tripoint &location, const float insulation, const temperature_flag flag ) + const tripoint &location, const float insulation, const temperature_flag flag, + const float spoil_multiplier ) { - if( item_ref->process( nullptr, location, insulation, flag ) ) { + if( item_ref->process( nullptr, location, insulation, flag, spoil_multiplier ) ) { // Item is to be destroyed so erase it from the map stack // unless it was already destroyed by processing. if( item_ref ) { @@ -4789,8 +4790,16 @@ void map::process_items_in_submap( submap ¤t_submap, const tripoint &gridp if( ter( map_location ) == t_rootcellar ) { flag = temperature_flag::ROOT_CELLAR; } + + float spoil_multiplier = 1.0f; + + if( has_flag( "NO_SPOIL", map_location ) ) { + spoil_multiplier = 0.0f; + } + map_stack items = i_at( map_location ); - process_map_items( items, active_item_ref.item_ref, map_location, 1, flag ); + + process_map_items( items, active_item_ref.item_ref, map_location, 1, flag, spoil_multiplier ); } } @@ -4865,7 +4874,7 @@ void map::process_items_in_vehicle( vehicle &cur_veh, submap ¤t_submap ) flag = temperature_flag::FREEZER; } } - if( !process_map_items( items, active_item_ref.item_ref, item_loc, it_insulation, flag ) ) { + if( !process_map_items( items, active_item_ref.item_ref, item_loc, it_insulation, flag, 1.0f ) ) { // If the item was NOT destroyed, we can skip the remainder, // which handles fallout from the vehicle being damaged. continue;