-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9d1782f
commit 68b48b4
Showing
5 changed files
with
99 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#pragma once | ||
|
||
namespace RE | ||
{ | ||
namespace Cascadia | ||
{ | ||
class TESHitEventWatcher : | ||
public BSTEventSink<TESHitEvent> | ||
{ | ||
virtual BSEventNotifyControl ProcessEvent(const TESHitEvent& a_event, BSTEventSource<TESHitEvent>*) override | ||
{ | ||
TESObjectREFR* target = a_event.target.get(); | ||
|
||
// Return early on invalid events. | ||
// Note: Unsure about the logic RE; Power Armor here. | ||
if (!target || !a_event.usesHitData || target->extraList->GetByType(kPowerArmor) != nullptr) | ||
{ | ||
return BSEventNotifyControl::kContinue; | ||
} | ||
|
||
Actor* actor = static_cast<Actor*>(target); | ||
|
||
// We're only interested in the player. | ||
if (target != PlayerCharacter::GetSingleton()) | ||
{ | ||
return BSEventNotifyControl::kContinue; | ||
} | ||
|
||
TESObjectREFR* sourceREFR = a_event.hitData.sourceRef.get().get(); | ||
|
||
BGSBodyPartData* bodyPartData = actor->GetBodyPartData(); | ||
|
||
// If sourceREFR is 'nullptr', most likely a melee attack. | ||
if (sourceREFR) | ||
{ | ||
if (sourceREFR->IsExplosion()) | ||
{ | ||
DEBUG("Explosion!"); | ||
} | ||
else | ||
{ | ||
|
||
} | ||
} | ||
else | ||
{ | ||
auto test = a_event.hitData.weapon.object->GetFormEditorID(); | ||
DEBUG("WEAPON USED: {}", test); | ||
} | ||
|
||
return BSEventNotifyControl::kContinue; | ||
} | ||
}; | ||
|
||
void RegisterTESHitEventSink() | ||
{ | ||
TESHitEventWatcher* tesHitEvent = new TESHitEventWatcher(); | ||
TESHitEvent::GetEventSource()->RegisterSink(tesHitEvent); | ||
INFO("Registed 'TESHitEvent' sink."); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters