Skip to content

Commit

Permalink
UObjectHook: Add "Enabled at Startup" option
Browse files Browse the repository at this point in the history
  • Loading branch information
praydog committed Dec 17, 2023
1 parent 725d144 commit 031d25c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/mods/UObjectHook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,10 @@ void UObjectHook::on_config_load(const utility::Config& cfg, bool set_defaults)
for (IModValue& option : m_options) {
option.config_load(cfg, set_defaults);
}

if (!set_defaults && m_enabled_at_startup->value()) {
m_wants_activate = true;
}
}

void UObjectHook::on_config_save(utility::Config& cfg) {
Expand Down Expand Up @@ -1507,6 +1511,7 @@ void UObjectHook::on_draw_sidebar_entry(std::string_view in_entry) {
}

void UObjectHook::draw_config() {
m_enabled_at_startup->draw("Enabled at Startup");
m_attach_lerp_enabled->draw("Enable Attach Lerp");
m_attach_lerp_speed->draw("Attach Lerp Speed");
}
Expand Down
2 changes: 2 additions & 0 deletions src/mods/UObjectHook.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,12 @@ class UObjectHook : public Mod {
std::vector<std::shared_ptr<PersistentProperties>> deserialize_all_persistent_properties() const;

private:
ModToggle::Ptr m_enabled_at_startup{ModToggle::create(generate_name("EnabledAtStartup"), false)};
ModToggle::Ptr m_attach_lerp_enabled{ModToggle::create(generate_name("AttachLerpEnabled"), true)};
ModSlider::Ptr m_attach_lerp_speed{ModSlider::create(generate_name("AttachLerpSpeed"), 0.01f, 30.0f, 15.0f)};

ValueList m_options{
*m_enabled_at_startup,
*m_attach_lerp_enabled,
*m_attach_lerp_speed
};
Expand Down

0 comments on commit 031d25c

Please sign in to comment.