-
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.
feat:
TESHarvestEvent
implementation, minor cleanup
- Loading branch information
1 parent
208bde6
commit 90663c5
Showing
3 changed files
with
48 additions
and
9 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,39 @@ | ||
#pragma once | ||
|
||
namespace RE | ||
{ | ||
namespace Cascadia | ||
{ | ||
class TESHarvestEventWatcher : | ||
public BSTEventSink<TESHarvestEvent::ItemHarvested> | ||
{ | ||
virtual BSEventNotifyControl ProcessEvent(const TESHarvestEvent::ItemHarvested& a_event, BSTEventSource<TESHarvestEvent::ItemHarvested>*) override | ||
{ | ||
if (a_event.harvestedBy == PlayerCharacter::GetSingleton()) | ||
{ | ||
DEBUG("Harvest event sent by player, harvested REFR: {}, harvest object: {}", a_event.referenceHarvested->GetFormEditorID(), a_event.itemHarvested->GetFormEditorID()); | ||
const char* itemHarvested = a_event.itemHarvested->GetFormEditorID(); | ||
|
||
if (strcmp(itemHarvested, "CAS_LL_WoodPile_Random") == 0) | ||
{ | ||
SendHUDMessage::ShowHUDMessage("Firewood Added.", nullptr, true, true); | ||
} | ||
else | ||
{ | ||
return BSEventNotifyControl::kContinue; | ||
} | ||
|
||
} | ||
|
||
return BSEventNotifyControl::kContinue; | ||
} | ||
}; | ||
|
||
void RegisterTESHarvestEventSink() | ||
{ | ||
TESHarvestEventWatcher* tesHarvestEvent = new TESHarvestEventWatcher(); | ||
TESHarvestEvent::ItemHarvested::GetEventSource()->RegisterSink(tesHarvestEvent); | ||
INFO("Registered 'TESHarvestEvent::ItemHarvested' 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