Skip to content

Commit

Permalink
Merge pull request #46924 from Kelenius/LetMeEatThisFetusLater
Browse files Browse the repository at this point in the history
Cloning vats now stop spoiling
  • Loading branch information
Rivet-the-Zombie authored Jan 22, 2021
2 parents d1e702b + e4db7cf commit 43dfb22
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion data/json/furniture_and_terrain/terrain-manufactured.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions doc/JSON_FLAGS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
17 changes: 13 additions & 4 deletions src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4595,9 +4595,10 @@ void map::update_lum( item_location &loc, bool add )
}

static bool process_map_items( item_stack &items, safe_reference<item> &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 ) {
Expand Down Expand Up @@ -4789,8 +4790,16 @@ void map::process_items_in_submap( submap &current_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 );
}
}

Expand Down Expand Up @@ -4865,7 +4874,7 @@ void map::process_items_in_vehicle( vehicle &cur_veh, submap &current_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;
Expand Down

0 comments on commit 43dfb22

Please sign in to comment.