Skip to content

Commit

Permalink
fix (#43)
Browse files Browse the repository at this point in the history
* fixed: another fix equipping/unequipping with 2 handed spells,
equipping spells with a task now (to avoid an infinite loop) (I might
rework the handing in the future to match the general equip handling)
  • Loading branch information
mlthelama authored Apr 14, 2023
2 parents aa2ba6b + 3dfef69 commit 34b13df
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.20)

set(NAME "LamasTinyHUD")
set(VERSION 1.4.3.0)
set(VERSION 1.4.4.0)

# ---- Options ----

Expand Down
2 changes: 0 additions & 2 deletions src/equip/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,6 @@ namespace equip {
}

logger::trace("try to equip weapon/shield/light {}"sv, a_form->GetName());

RE::ActorEquipManager::GetSingleton()->EquipObject(a_player, obj, extra, 1, a_slot);
logger::trace("equipped weapon/shield/light {}, left {}. return."sv, a_form->GetName(), left);
}
Expand Down Expand Up @@ -202,7 +201,6 @@ namespace equip {
}

logger::trace("calling drink/eat potion/food {}, count left {}"sv, obj->GetName(), left);

RE::ActorEquipManager::GetSingleton()->EquipObject(a_player, obj);
logger::trace("drank/ate potion/food {}. return."sv, obj->GetName());
}
Expand Down
8 changes: 7 additions & 1 deletion src/equip/magic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,13 @@ namespace equip {
return;
}

RE::ActorEquipManager::GetSingleton()->EquipSpell(a_player, spell, a_slot);
logger::trace("calling equip spell {}, left {}"sv, spell->GetName(), left);
auto* task = SKSE::GetTaskInterface();
if (task) {
task->AddTask([a_player, spell, a_slot]() {
RE::ActorEquipManager::GetSingleton()->EquipSpell(a_player, spell, a_slot);
});
}
}

logger::trace("worked spell {}, action {}. return."sv, a_form->GetName(), static_cast<uint32_t>(a_action));
Expand Down
2 changes: 1 addition & 1 deletion src/equip/magic.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ namespace equip {
class magic {
public:
using action_type = handle::slot_setting::action_type;

static void cast_magic(RE::TESForm* a_form,
action_type a_action,
const RE::BGSEquipSlot* a_slot,
Expand Down
4 changes: 3 additions & 1 deletion src/processing/setting_execute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ namespace processing {
if (!a_setting) {
return;
}
logger::trace("checking and calling re equip for setting {}"sv, static_cast<uint32_t>(a_setting->position));
logger::trace("checking and calling re equip for setting {}, is setting empty {}"sv,
static_cast<uint32_t>(a_setting->position),
a_setting->slot_settings.empty());
auto* left_slot = equip::equip_slot::get_left_hand_slot();
auto* equip_manager = RE::ActorEquipManager::GetSingleton();
auto* player = RE::PlayerCharacter::GetSingleton();
Expand Down
13 changes: 6 additions & 7 deletions src/util/helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,21 +96,20 @@ namespace util {
return false;
}

//check if two-handed
auto two_handed = false;
if (a_form->Is(RE::FormType::Spell)) {
if (const auto* spell = a_form->As<RE::SpellItem>(); spell->IsTwoHanded()) {
return true;
two_handed = true;
}
}

if (a_form->IsWeapon()) {
} else if (a_form->IsWeapon()) {
if (const auto* weapon = a_form->As<RE::TESObjectWEAP>();
weapon->IsTwoHandedAxe() || weapon->IsTwoHandedSword() || weapon->IsBow() || weapon->IsCrossbow()) {
return true;
two_handed = true;
}
}

return false;
//logger::trace("form {}, two handed {}"sv, a_form->GetName(), two_handed);
return two_handed;
}

handle::slot_setting::slot_type helper::get_type(RE::TESForm*& a_form) {
Expand Down
2 changes: 1 addition & 1 deletion vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lamastinyhud",
"version-string": "1.4.3",
"version-string": "1.4.4",
"description": "hud element for skyrim",
"homepage": "https://github.com/mlthelama/LamasTinyHUD",
"license": "GPL-2.0-or-later",
Expand Down

0 comments on commit 34b13df

Please sign in to comment.