From b3bf231e077ea7b1a5abf528986ea70b70d0b2e3 Mon Sep 17 00:00:00 2001 From: MarlossCDDA <78324429+MarlossCDDA@users.noreply.github.com> Date: Sun, 23 May 2021 13:55:30 -0400 Subject: [PATCH] [bugfix] Respect rot_spawn_chance I broke it in https://github.com/CleverRaven/Cataclysm-DDA/pull/48116, made it treat everything as if it had rot_spawn_chance = 100. Was most noticable for unfertilized eggs, which really shouldn't hatch. --- src/map.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/map.cpp b/src/map.cpp index 68747009132bc..b8e08f5da0ca3 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -6988,13 +6988,16 @@ void map::rotten_item_spawn( const item &item, const tripoint &pnt ) if( mgroup.is_null() ) { return; } - MonsterGroupResult spawn_details = MonsterGroupManager::GetResultFromGroup( mgroup ); - add_spawn( spawn_details, pnt ); - if( get_player_view().sees( pnt ) ) { - if( item.is_seed() ) { - add_msg( m_warning, _( "Something has crawled out of the %s plants!" ), item.get_plant_name() ); - } else { - add_msg( m_warning, _( "Something has crawled out of the %s!" ), item.tname() ); + + if( rng( 0, 100 ) < comest->rot_spawn_chance ) { + MonsterGroupResult spawn_details = MonsterGroupManager::GetResultFromGroup( mgroup ); + add_spawn( spawn_details, pnt ); + if( get_player_view().sees( pnt ) ) { + if( item.is_seed() ) { + add_msg( m_warning, _( "Something has crawled out of the %s plants!" ), item.get_plant_name() ); + } else { + add_msg( m_warning, _( "Something has crawled out of the %s!" ), item.tname() ); + } } } }