1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00
This commit is contained in:
Gwyndolyn Shafer 2025-06-14 12:39:09 +02:00 committed by GitHub
commit 4cda456ec2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 41 additions and 5 deletions

View file

@ -130,6 +130,11 @@ local function load()
{ heading = fgettext_ne("Movement") },
"arm_inertia",
"view_bobbing_amount",
{ heading = fgettext_ne("Damage") },
"damage_flash_enable",
"damage_tilt_enable",
"damage_tilt_strength",
"damage_tilt_duration",
},
})

View file

@ -491,6 +491,26 @@ 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]
# Damage flash, causes the screen to flash reduce
# when the player takes damage.
damage_flash_enable (Damage flash) bool true
# Damage tilt, causes the screen to shake
# when the player takes damage
damage_tilt_enable (Damage shake) bool true
# Damage tilt strength. Controls the force of
# camera shakes from taking damage
damage_tilt_strength (Damage shake strength) float 1.0 0.0 2.0
# Damage tilt duration modifier. Controls the duration of
# camera shakes from taking damage.
# 0.0 for no time, 1.0 for normal time, 2.0 for twice as long.
damage_tilt_duration (Damage shake duration) float 1.0 0.0 2.0
[**Camera]
# Field of view in degrees.

View file

@ -2689,12 +2689,19 @@ 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("damage_flash_enable")) {
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 =
rangelim(damage_ratio * 5.0f, 1.0f, 4.0f);
f32 tilt_duration = g_settings->getFloat("damage_tilt_duration");
if (tilt_duration > 0.0f && g_settings->getBool("damage_tilt_enable")) {
player->hurt_tilt_timer = 1.5f * tilt_duration;
f32 tilt_strength = g_settings->getFloat("damage_tilt_strength");
player->hurt_tilt_strength =
rangelim(damage_ratio * 5.0f, 1.0f, 4.0f) * tilt_strength;
}
}
// Play damage sound

View file

@ -306,6 +306,10 @@ void set_default_settings()
settings->setDefault("show_entity_selectionbox", "false");
settings->setDefault("ambient_occlusion_gamma", "1.8");
settings->setDefault("arm_inertia", "true");
settings->setDefault("damage_flash_enable", "true");
settings->setDefault("damage_tilt_enable", "true");
settings->setDefault("damage_tilt_strength", "1.0");
settings->setDefault("damage_tilt_duration", "1.0");
settings->setDefault("show_nametag_backgrounds", "true");
settings->setDefault("show_block_bounds_radius_near", "4");
settings->setDefault("transparency_sorting_group_by_buffers", "true");