diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt index d145a42be..b8be2c4c8 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/config/PlayerConfig.kt @@ -14,6 +14,14 @@ object PlayerConfig : AbstractConfig("player") { .comment("And also whenever to regenerate energy while in peaceful") .define("REGENERATE_ENERGY", true) + val REGENERATE_ENERGY_EFFICIENCY_FOOD: Double by builder + .comment("How much % of food points to convert to energy") + .defineInRange("REGENERATE_ENERGY_EFFICIENCY_FOOD", 0.75, 0.0) + + val REGENERATE_ENERGY_EFFICIENCY_SATURATION: Double by builder + .comment("How much % of food saturation points to convert to energy") + .defineInRange("REGENERATE_ENERGY_EFFICIENCY_SATURATION", 0.4, 0.0) + val REGENERATE_ENERGY_IN_PEACEFUL: Boolean by builder .comment("Regenerate energy while in peaceful") .comment("This is disabled by default because this is easily exploitable") diff --git a/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryFoodData.kt b/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryFoodData.kt index 279438107..1ffbc6b74 100644 --- a/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryFoodData.kt +++ b/src/main/kotlin/ru/dbotthepony/mc/otm/player/MatteryFoodData.kt @@ -25,7 +25,8 @@ import kotlin.math.roundToInt class MatteryFoodData(private var player: Player) : FoodData() { private fun add(foodLevel: Int, saturation: Float) { if (player.matteryPlayer.isAndroid && PlayerConfig.REGENERATE_ENERGY) { - energyToDrain -= PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT * foodLevel + PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT * saturation + energyToDrain -= PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT * foodLevel * PlayerConfig.REGENERATE_ENERGY_EFFICIENCY_FOOD + energyToDrain -= PlayerConfig.ANDROID_ENERGY_PER_HUNGER_POINT * saturation.coerceAtMost(PlayerConfig.Food.SOFT_FOOD_LIMIT.toFloat()) * PlayerConfig.REGENERATE_ENERGY_EFFICIENCY_SATURATION } else if (!player.matteryPlayer.isAndroid) { this.foodLevel = min(this.foodLevel + foodLevel, PlayerConfig.Food.HARD_FOOD_LIMIT) this.saturationLevel = min(this.saturationLevel + saturation, this.foodLevel + PlayerConfig.Food.OVERSATURATION_LIMIT.toFloat()).coerceAtLeast(0f)