Tough As Nails

Tough As Nails

21M Downloads

Make Hypothermia/Hyperthermia Damage Tweakable/Configurable

Kongga666 opened this issue ยท 1 comments

commented

Overview

Allow through config, the possibility to increase/decrease Hypothermia/Hypertermia damages, or even increase food exhaustion or thirst.

Code Exemple

In TemperatureHandler.java

 // Hurt the player if hyperthermic
        if (TemperatureHelper.isFullyHyperthermic(player)) {
            if (player.tickCount % 80 == 0) {
                ThirstHelper.getThirst(player).addExhaustion(3.0F);
            }
            if (player.tickCount % 320 == 0) {
                player.hurt(player.damageSources().source(TANDamageTypes.HYPERTHERMIA), 1);
            }
        }

In MixinLivingEntity.java

@Redirect(method = "aiStep", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;isFullyFrozen()Z", ordinal = 0))
public boolean onAiStep_isFullyFrozen(LivingEntity instance) {
    if (!(instance instanceof Player)) {
        return instance.isFullyFrozen();
    }
    Player player = (Player) instance;

    if (!player.level().isClientSide && player.tickCount % 40 == 0 && player.isFullyFrozen() && player.canFreeze()) {
        if (player.tickCount % 80 == 0) {
            player.getFoodData().addExhaustion(3.0F);
        }
        if (player.tickCount % 320 == 0) {
            player.hurt(player.damageSources().freeze(), 1.0F);
        }
    }
    return false;
}

In those exemples, Hypothermia/Hyperthermia deal much more less damage, but increase fatigue (food/thirst) much more quicker.

Why would this feature be useful?

This Configurable feature will allow players to softer the mod (yeah i know the mod name is TOUGH as Nails), and make temperature managment less prominent, much in line with food and thirst managment.

The players would be able to tweak their experience to their need.
We can even imagine things like:

  • No damage
  • More damage
  • Cold consume slowly food
  • Warm consume slowly thirst
  • Hypothermia, drains food + small damages
  • Hyperthermia, drains thirst + small damages
  • etc...

I proposed this idea, because i tweaked the code for a private server with my friend, and wanted to play with this mod, but my friend wanted to nerf the Hypotermia/Hypertermia mechanics.
If my friends, wanted the mechanics nerfed, i guessed other players might want it.

commented

please add this