mirror of
https://github.com/IntQuant/noita_entangled_worlds.git
synced 2025-10-19 07:03:16 +00:00
add option to disable global perks and disable spells
This commit is contained in:
parent
96a770c65f
commit
abd3c321f6
6 changed files with 111 additions and 8 deletions
|
@ -135,6 +135,8 @@ pub struct GameSettings {
|
||||||
no_material_damage: Option<bool>,
|
no_material_damage: Option<bool>,
|
||||||
global_hp_loss: Option<bool>,
|
global_hp_loss: Option<bool>,
|
||||||
perk_ban_list: Option<String>,
|
perk_ban_list: Option<String>,
|
||||||
|
disabled_globals: Option<String>,
|
||||||
|
spell_ban_list: Option<String>,
|
||||||
physics_damage: Option<bool>,
|
physics_damage: Option<bool>,
|
||||||
share_gold: Option<bool>,
|
share_gold: Option<bool>,
|
||||||
nice_terraforming: Option<bool>,
|
nice_terraforming: Option<bool>,
|
||||||
|
@ -420,6 +422,35 @@ impl GameSettings {
|
||||||
game_settings.give_host_sampo = Some(temp)
|
game_settings.give_host_sampo = Some(temp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
let mut temp = game_settings.enemy_hp_mult.unwrap_or(def.enemy_hp_mult);
|
||||||
|
if ui
|
||||||
|
.add(
|
||||||
|
Slider::new(&mut temp, 1.0..=1000.0)
|
||||||
|
.logarithmic(true)
|
||||||
|
.text(tr("connect_settings_enemy_hp_scale")),
|
||||||
|
)
|
||||||
|
.changed()
|
||||||
|
{
|
||||||
|
game_settings.enemy_hp_mult = Some(temp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
let mut temp = game_settings
|
||||||
|
.spell_ban_list
|
||||||
|
.clone()
|
||||||
|
.unwrap_or(def.spell_ban_list);
|
||||||
|
ui.label("spell ban list, by internal names, comma seperated");
|
||||||
|
if ui
|
||||||
|
.add_sized(
|
||||||
|
[ui.available_width() - 30.0, 20.0],
|
||||||
|
egui::TextEdit::singleline(&mut temp),
|
||||||
|
)
|
||||||
|
.changed()
|
||||||
|
{
|
||||||
|
game_settings.spell_ban_list = Some(temp)
|
||||||
|
}
|
||||||
|
}
|
||||||
ui.add_space(10.0);
|
ui.add_space(10.0);
|
||||||
ui.label("Player settings");
|
ui.label("Player settings");
|
||||||
ui.horizontal(|ui| {
|
ui.horizontal(|ui| {
|
||||||
|
@ -478,7 +509,7 @@ impl GameSettings {
|
||||||
.perk_ban_list
|
.perk_ban_list
|
||||||
.clone()
|
.clone()
|
||||||
.unwrap_or(def.perk_ban_list);
|
.unwrap_or(def.perk_ban_list);
|
||||||
ui.label("perk ban list, comma seperated");
|
ui.label("perk ban list, by internal names, comma seperated");
|
||||||
if ui
|
if ui
|
||||||
.add_sized(
|
.add_sized(
|
||||||
[ui.available_width() - 30.0, 20.0],
|
[ui.available_width() - 30.0, 20.0],
|
||||||
|
@ -490,16 +521,19 @@ impl GameSettings {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
let mut temp = game_settings.enemy_hp_mult.unwrap_or(def.enemy_hp_mult);
|
let mut temp = game_settings
|
||||||
|
.disabled_globals
|
||||||
|
.clone()
|
||||||
|
.unwrap_or(def.disabled_globals);
|
||||||
|
ui.label("global perks to ignore, by internal names, comma seperated, will cause undefined behaviour do not report issues, find list in perk_fns.lua");
|
||||||
if ui
|
if ui
|
||||||
.add(
|
.add_sized(
|
||||||
Slider::new(&mut temp, 1.0..=1000.0)
|
[ui.available_width() - 30.0, 20.0],
|
||||||
.logarithmic(true)
|
egui::TextEdit::singleline(&mut temp),
|
||||||
.text(tr("connect_settings_enemy_hp_scale")),
|
|
||||||
)
|
)
|
||||||
.changed()
|
.changed()
|
||||||
{
|
{
|
||||||
game_settings.enemy_hp_mult = Some(temp)
|
game_settings.disabled_globals = Some(temp)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ui.button(tr("apply_default_settings")).clicked() {
|
if ui.button(tr("apply_default_settings")).clicked() {
|
||||||
|
@ -521,6 +555,8 @@ pub struct DefaultSettings {
|
||||||
no_material_damage: bool,
|
no_material_damage: bool,
|
||||||
global_hp_loss: bool,
|
global_hp_loss: bool,
|
||||||
perk_ban_list: String,
|
perk_ban_list: String,
|
||||||
|
disabled_globals: String,
|
||||||
|
spell_ban_list: String,
|
||||||
physics_damage: bool,
|
physics_damage: bool,
|
||||||
share_gold: bool,
|
share_gold: bool,
|
||||||
nice_terraforming: bool,
|
nice_terraforming: bool,
|
||||||
|
@ -554,6 +590,8 @@ impl Default for DefaultSettings {
|
||||||
no_material_damage: false,
|
no_material_damage: false,
|
||||||
global_hp_loss: false,
|
global_hp_loss: false,
|
||||||
perk_ban_list: String::new(),
|
perk_ban_list: String::new(),
|
||||||
|
disabled_globals: String::new(),
|
||||||
|
spell_ban_list: String::new(),
|
||||||
physics_damage: true,
|
physics_damage: true,
|
||||||
share_gold: false,
|
share_gold: false,
|
||||||
nice_terraforming: true,
|
nice_terraforming: true,
|
||||||
|
|
|
@ -969,6 +969,16 @@ impl NetManager {
|
||||||
"perk_ban_list",
|
"perk_ban_list",
|
||||||
lst.perk_ban_list.unwrap_or(def.perk_ban_list).as_str(),
|
lst.perk_ban_list.unwrap_or(def.perk_ban_list).as_str(),
|
||||||
);
|
);
|
||||||
|
state.try_ws_write_option(
|
||||||
|
"spell_ban_list",
|
||||||
|
lst.spell_ban_list.unwrap_or(def.spell_ban_list).as_str(),
|
||||||
|
);
|
||||||
|
state.try_ws_write_option(
|
||||||
|
"disabled_globals",
|
||||||
|
lst.disabled_globals
|
||||||
|
.unwrap_or(def.disabled_globals)
|
||||||
|
.as_str(),
|
||||||
|
);
|
||||||
state.try_ws_write_option(
|
state.try_ws_write_option(
|
||||||
"disable_kummitus",
|
"disable_kummitus",
|
||||||
settings.disable_kummitus.unwrap_or(def.disable_kummitus),
|
settings.disable_kummitus.unwrap_or(def.disable_kummitus),
|
||||||
|
|
|
@ -247,6 +247,17 @@ function perk_fns.update_perks_for_entity(perk_data, entity, allow_perk)
|
||||||
-- util.set_ent_variable(entity, "ew_current_perks", perk_data)
|
-- util.set_ent_variable(entity, "ew_current_perks", perk_data)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function string_split(s, splitter)
|
||||||
|
local words = {}
|
||||||
|
if s == nil or splitter == nil or s == "" then
|
||||||
|
return {}
|
||||||
|
end
|
||||||
|
for word in string.gmatch(s, "([^" .. splitter .. "]+)") do
|
||||||
|
table.insert(words, word)
|
||||||
|
end
|
||||||
|
return words
|
||||||
|
end
|
||||||
|
|
||||||
local first = true
|
local first = true
|
||||||
|
|
||||||
function perk_fns.on_world_update()
|
function perk_fns.on_world_update()
|
||||||
|
@ -268,6 +279,9 @@ function perk_fns.on_world_update()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
for _, perk in ipairs(string_split(ctx.proxy_opt.disabled_globals, ",")) do
|
||||||
|
global_perks[perk] = nil
|
||||||
|
end
|
||||||
first = false
|
first = false
|
||||||
end
|
end
|
||||||
if
|
if
|
||||||
|
|
|
@ -81,7 +81,7 @@ end)
|
||||||
|
|
||||||
local function string_split(s, splitter)
|
local function string_split(s, splitter)
|
||||||
local words = {}
|
local words = {}
|
||||||
if s == nil or splitter == nil then
|
if s == nil or splitter == nil or s == "" then
|
||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
for word in string.gmatch(s, "([^" .. splitter .. "]+)") do
|
for word in string.gmatch(s, "([^" .. splitter .. "]+)") do
|
||||||
|
|
27
quant.ew/files/system/spell_patches/banned_spells.lua
Normal file
27
quant.ew/files/system/spell_patches/banned_spells.lua
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
local function string_split(s, splitter)
|
||||||
|
local words = {}
|
||||||
|
if s == nil or splitter == nil or s == "" then
|
||||||
|
return {}
|
||||||
|
end
|
||||||
|
for word in string.gmatch(s, "([^" .. splitter .. "]+)") do
|
||||||
|
table.insert(words, word)
|
||||||
|
end
|
||||||
|
return words
|
||||||
|
end
|
||||||
|
local t = string_split(CrossCall("ew_banned_spells"), ",")
|
||||||
|
local old = GetRandomActionWithType
|
||||||
|
function GetRandomActionWithType(...)
|
||||||
|
local n = old
|
||||||
|
while table.contains(t, n) do
|
||||||
|
n = old
|
||||||
|
end
|
||||||
|
return n
|
||||||
|
end
|
||||||
|
old = GetRandomAction
|
||||||
|
function GetRandomAction(...)
|
||||||
|
local n = old
|
||||||
|
while table.contains(t, n) do
|
||||||
|
n = old
|
||||||
|
end
|
||||||
|
return n
|
||||||
|
end
|
|
@ -16,4 +16,18 @@ util.copy_file_content(
|
||||||
"data/scripts/projectiles/essence_to_power.lua"
|
"data/scripts/projectiles/essence_to_power.lua"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if ctx.proxy_opt.spell_ban_list ~= nil and ctx.proxy_opt.spell_ban_list ~= "" then
|
||||||
|
util.add_cross_call("ew_banned_spells", function()
|
||||||
|
return ctx.proxy_opt.spell_ban_list
|
||||||
|
end)
|
||||||
|
for _, file in ipairs({
|
||||||
|
"data/scripts/perks/perk_list.lua",
|
||||||
|
"data/scripts/items/generate_shop_item.lua",
|
||||||
|
"data/scripts/gun/procedural/gun_procedural_better.lua",
|
||||||
|
"data/scripts/gun/procedural/gun_procedural.lua",
|
||||||
|
}) do
|
||||||
|
ModLuaFileAppend(file, "mods/quant.ew/files/system/spell_patches/banned_spells.lua")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return {}
|
return {}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue