add physics damage option for notplayer enabled by default

This commit is contained in:
bgkillas 2024-11-13 20:40:23 -05:00
parent 06b61957bc
commit 85c2b3cfc1
4 changed files with 23 additions and 1 deletions

View file

@ -100,6 +100,7 @@ Health-percent-lost-on-reviving = Percent of Max HP lost on reviving
global_hp_loss = Lose HP globally global_hp_loss = Lose HP globally
no_material_damage = No material damage no_material_damage = No material damage
perma_death = Perma death perma_death = Perma death
physics_damage = Physics damage
shared_health_desc_1 = Health is shared, but scales with player count. shared_health_desc_1 = Health is shared, but scales with player count.
shared_health_desc_2 = Percentage-based damage and full heals are adjusted. shared_health_desc_2 = Percentage-based damage and full heals are adjusted.
shared_health_desc_3 = The original mode. shared_health_desc_3 = The original mode.

View file

@ -89,6 +89,7 @@ pub struct GameSettings {
global_hp_loss: Option<bool>, global_hp_loss: Option<bool>,
perk_ban_list: Option<String>, perk_ban_list: Option<String>,
perma_death: Option<bool>, perma_death: Option<bool>,
physics_damage: Option<bool>,
} }
pub struct DefaultSettings { pub struct DefaultSettings {
@ -112,6 +113,7 @@ pub struct DefaultSettings {
global_hp_loss: bool, global_hp_loss: bool,
perk_ban_list: String, perk_ban_list: String,
perma_death: bool, perma_death: bool,
physics_damage: bool,
} }
impl Default for DefaultSettings { impl Default for DefaultSettings {
@ -136,7 +138,8 @@ impl Default for DefaultSettings {
no_material_damage: false, no_material_damage: false,
global_hp_loss: false, global_hp_loss: false,
perk_ban_list: "GLOBAL_GORE,GLASS_CANNON,REVENGE_RATS,PLAGUE_RATS,VOMIT_RATS,CORDYCEPS,MOLD,FUNGAL_DISEASE,HOMUNCULUS,LUKKI_MINION".to_string(), perk_ban_list: "GLOBAL_GORE,GLASS_CANNON,REVENGE_RATS,PLAGUE_RATS,VOMIT_RATS,CORDYCEPS,MOLD,FUNGAL_DISEASE,HOMUNCULUS,LUKKI_MINION".to_string(),
perma_death: false perma_death: false,
physics_damage: true,
} }
} }
} }
@ -815,6 +818,16 @@ impl App {
game_settings.perma_death = Some(temp) game_settings.perma_death = Some(temp)
} }
} }
ui.add_space(1.0);
{
let mut temp = game_settings.physics_damage.unwrap_or(def.physics_damage);
if ui.checkbox(
&mut temp,
tr("physics_damage"),
).changed() {
game_settings.physics_damage = Some(temp)
}
}
} }
} }
}); });

View file

@ -553,6 +553,10 @@ impl NetManager {
"perma_death", "perma_death",
settings.perma_death.unwrap_or(def.perma_death), settings.perma_death.unwrap_or(def.perma_death),
); );
state.try_ws_write_option(
"physics_damage",
settings.physics_damage.unwrap_or(def.physics_damage),
);
let lst = settings.clone(); let lst = settings.clone();
state.try_ws_write_option( state.try_ws_write_option(
"perk_ban_list", "perk_ban_list",

View file

@ -239,6 +239,10 @@ local function player_died()
end end
local ent = LoadGameEffectEntityTo(ctx.my_player.entity, "mods/quant.ew/files/system/local_health/notplayer/poly_effect.xml") local ent = LoadGameEffectEntityTo(ctx.my_player.entity, "mods/quant.ew/files/system/local_health/notplayer/poly_effect.xml")
ctx.my_player.entity = ent + 1 ctx.my_player.entity = ent + 1
if ctx.proxy_opt.physics_damage then
local damage = EntityGetFirstComponentIncludingDisabled(ctx.my_player.entity, "DamageModelComponent")
ComponentSetValue2(damage, "physics_objects_damage", true)
end
do_switch_effect(false) do_switch_effect(false)
EntitySetName(ctx.my_player.entity, ctx.my_id.."?") EntitySetName(ctx.my_player.entity, ctx.my_id.."?")
util.set_ent_health(ctx.my_player.entity, {max_hp, max_hp}) util.set_ent_health(ctx.my_player.entity, {max_hp, max_hp})