1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-08-06 17:41:04 +00:00

Add setting to disable damage flash

Adds a new boolean setting for the client under Accessibility in a new section called Damage
See https://github.com/luanti-org/luanti/issues/15805 for more information
This commit is contained in:
Alec 2025-04-11 16:18:48 -07:00
parent 78293404c7
commit 8d235bbc51
4 changed files with 12 additions and 2 deletions

View file

@ -161,6 +161,8 @@ local function load()
{ heading = fgettext_ne("Movement") },
"arm_inertia",
"view_bobbing_amount",
{ heading = fgettext_ne("Damage") },
"hurt_flash_enabled"
},
})

View file

@ -332,6 +332,11 @@ arm_inertia (Arm inertia) bool true
# For example: 0 for no view bobbing; 1.0 for normal; 2.0 for double.
view_bobbing_amount (View bobbing factor) float 1.0 0.0 7.9
[**Damage]
# Flashing of the screen when taking damage.
hurt_flash_enabled (Damage flash) bool true
[**Camera]
# Field of view in degrees.

View file

@ -2616,8 +2616,10 @@ void Game::handleClientEvent_PlayerDamage(ClientEvent *event, CameraOrientation
player->getCAO()->getProperties().hp_max : PLAYER_MAX_HP_DEFAULT;
f32 damage_ratio = event->player_damage.amount / hp_max;
runData.damage_flash += 95.0f + 64.f * damage_ratio;
runData.damage_flash = MYMIN(runData.damage_flash, 127.0f);
if (g_settings->getBool("hurt_flash_enabled")) {
runData.damage_flash += 95.0f + 64.f * damage_ratio;
runData.damage_flash = MYMIN(runData.damage_flash, 127.0f);
}
player->hurt_tilt_timer = 1.5f;
player->hurt_tilt_strength =

View file

@ -306,6 +306,7 @@ void set_default_settings()
settings->setDefault("show_entity_selectionbox", "false");
settings->setDefault("ambient_occlusion_gamma", "1.8");
settings->setDefault("arm_inertia", "true");
settings->setDefault("hurt_flash_enabled", "true");
settings->setDefault("show_nametag_backgrounds", "true");
settings->setDefault("show_block_bounds_radius_near", "4");
settings->setDefault("transparency_sorting_group_by_buffers", "true");