diff --git a/doc/JSON_INFO.md b/doc/JSON_INFO.md index 2ccd779fd0875..b6b4395ddfd60 100644 --- a/doc/JSON_INFO.md +++ b/doc/JSON_INFO.md @@ -3019,7 +3019,7 @@ See [MUTATIONS.md](MUTATIONS.md) "always_invisible": true, // Super well hidden traps the player can never detect "funnel_radius": 200, // millimeters. The higher the more rain it will capture. "comfort": 0, // Same property affecting furniture and terrain - "floor_bedding_warmth": -500, // Same property affecting furniture and terrain + "floor_bedding_warmth": -500, // Same property affecting furniture and terrain. Also affects how comfortable a resting place this is(affects healing). Vanilla values should not exceed 1000. "spell_data": { "id": "bear_trap" }, // data required for trapfunc::spell() "trigger_weight": "200 g", // If an item with this weight or more is thrown onto the trap, it triggers. Defaults to 500 grams. "drops": [ "beartrap" ], // ID of item spawned when disassembled @@ -3249,7 +3249,7 @@ These values apply to crafting tasks performed at the WORKBENCH. #### The following optional fields are specific to SEATs. ```c++ "comfort": 3, // (Optional, default=0). Sleeping comfort as for terrain/furniture. -"floor_bedding_warmth": 300, // (Optional, default=0). Bonus warmth as for terrain/furniture. +"floor_bedding_warmth": 300, // (Optional, default=0). Bonus warmth as for terrain/furniture. Also affects how comfortable a resting place this is(affects healing). Vanilla values should not exceed 1000. "bonus_fire_warmth_feet": 200,// (Optional, default=0). Bonus fire warmth as for terrain/furniture. ``` @@ -5482,7 +5482,7 @@ How comfortable this terrain/furniture is. Impact ability to fall asleep on it. #### `floor_bedding_warmth` -Bonus warmth offered by this terrain/furniture when used to sleep. +Bonus warmth offered by this terrain/furniture when used to sleep. Also affects how comfortable a resting place this is(affects healing). Vanilla values should not exceed 1000. #### `bonus_fire_warmth_feet` diff --git a/src/character.cpp b/src/character.cpp index 7338e3518f5ab..df024ed54e575 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -6165,6 +6165,7 @@ float Character::rest_quality() const map &here = get_map(); const tripoint your_pos = pos(); float rest = 0.0f; + const float ur_act_level = instantaneous_activity_level(); // Negative morales are penalties int cold_penalty = -has_morale( morale_cold ); int heat_penalty = -has_morale( morale_hot ); @@ -6182,7 +6183,7 @@ float Character::rest_quality() const } const optional_vpart_position veh_part = here.veh_at( your_pos ); bool has_vehicle_seat = !!veh_part.part_with_feature( "SEAT", true ); - if( activity_level() <= LIGHT_EXERCISE ) { + if( ur_act_level <= LIGHT_EXERCISE ) { rest += 0.1f; if( here.has_flag_ter_or_furn( "CAN_SIT", your_pos.xy() ) || has_vehicle_seat ) { // If not performing any real exercise (not even moving around), chairs allow you to rest a little bit. @@ -6191,20 +6192,21 @@ float Character::rest_quality() const // Any comfortable bed can substitute for a chair, but only if you don't have one. rest += 0.2f * ( units::to_celsius_delta( floor_bedding_warmth( your_pos ) ) / 2.0f ); } - if( activity_level() <= NO_EXERCISE ) { + if( ur_act_level <= NO_EXERCISE ) { rest += 0.2f; } } // These stack! - if( activity_level() >= BRISK_EXERCISE ) { + if( ur_act_level >= BRISK_EXERCISE ) { rest -= 0.1f; } - if( activity_level() >= ACTIVE_EXERCISE ) { + if( ur_act_level >= ACTIVE_EXERCISE ) { rest -= 0.2f; } - if( activity_level() >= EXTRA_EXERCISE ) { + if( ur_act_level >= EXTRA_EXERCISE ) { rest -= 0.3f; } + add_msg_debug( debugmode::DF_CHAR_HEALTH, "%s resting quality: %.6f", get_name(), rest ); return rest; } @@ -6437,7 +6439,8 @@ float Character::healing_rate_medicine( float at_rest_quality, const bodypart_id } rate_medicine *= mutation_value( "healing_multiplier" ); - rate_medicine *= 1.0f + clamp( at_rest_quality, 0.0f, 1.0f ); + // Sufficiently negative rest quality can completely eliminate your healing, but never turn it negative. + rate_medicine *= 1.0f + std::max( at_rest_quality, -1.0f ); // increase healing if character has both effects if( has_effect( effect_bandaged ) && has_effect( effect_disinfected ) ) {