47 using Lock = std::recursive_mutex;
48 using Locker = std::lock_guard<Lock>;
53 std::map<RE::FormID, std::set<RE::VMHandle>>
_regs;
58 template <
class Enable,
class... Args>
61 template <
class... Args>
65 RE::BSScript::is_return_convertible<Args>...>>,
92 const auto targetID = a_target->
GetFormID();
93 if (
const auto it = _regs.find(targetID); it != _regs.end()) {
94 for (
auto& handle : it->second) {
96 vm->SendEvent(handle, eventName, args);
104 std::tuple args(
VMArg(std::forward<Args>(a_args))...);
108 task->AddTask([a_target, args,
this]()
mutable {
115 template <
class Tuple, std::size_t... I>
116 inline void SendEvent_Tuple(
RE::TESObjectREFR* a_target, Tuple&& a_tuple, std::index_sequence<I...>)
118 SendEvent(a_target, std::get<I>(std::forward<Tuple>(a_tuple)).Unpack()...);
148 const auto targetID = a_target->
GetFormID();
149 if (
const auto it = _regs.find(targetID); it != _regs.end()) {
150 for (
auto& handle : it->second) {
152 vm->SendEvent(handle, eventName, args);
162 task->AddTask([a_target,
this]() {
169 template <
class... Args>
Definition ActiveEffect.h:27
Definition BGSRefAlias.h:15
static VirtualMachine * GetSingleton()
Definition TESObjectREFR.h:112
void SendEvent(RE::TESObjectREFR *a_target, Args... a_args)
Definition RegistrationSetUnique.h:87
RegistrationSetUnique(RegistrationSetUnique &&)=default
RegistrationSetUnique()=delete
~RegistrationSetUnique()=default
RegistrationSetUnique & operator=(RegistrationSetUnique &&)=default
void QueueEvent(RE::TESObjectREFR *a_target, Args... a_args)
Definition RegistrationSetUnique.h:102
RegistrationSetUnique(const std::string_view &a_eventName)
Definition RegistrationSetUnique.h:77
RegistrationSetUnique & operator=(const RegistrationSetUnique &)=default
RegistrationSetUnique(const RegistrationSetUnique &)=default
void QueueEvent(RE::TESObjectREFR *a_target)
Definition RegistrationSetUnique.h:158
void SendEvent(RE::TESObjectREFR *a_target)
Definition RegistrationSetUnique.h:143
RegistrationSetUnique & operator=(const RegistrationSetUnique &)=default
RegistrationSetUnique(const RegistrationSetUnique &)=default
~RegistrationSetUnique()=default
RegistrationSetUnique(const std::string_view &a_eventName)
Definition RegistrationSetUnique.h:133
RegistrationSetUnique(RegistrationSetUnique &&)=default
RegistrationSetUnique()=delete
RegistrationSetUnique & operator=(RegistrationSetUnique &&)=default
Definition RegistrationSetUnique.h:21
std::map< RE::FormID, std::set< RE::VMHandle > > _regs
Definition RegistrationSetUnique.h:53
bool Unregister(const void *a_object, RE::FormID a_formID, RE::VMTypeID a_typeID)
std::string _eventName
Definition RegistrationSetUnique.h:54
bool Register(RE::TESForm *a_form)
~RegistrationSetUniqueBase()
RegistrationSetUniqueBase & operator=(RegistrationSetUniqueBase &&a_rhs)
bool Unregister(RE::BGSRefAlias *a_alias)
bool Register(RE::BGSRefAlias *a_alias)
RegistrationSetUniqueBase(const RegistrationSetUniqueBase &a_rhs)
bool Unregister(RE::ActiveEffect *a_activeEffect)
Lock _lock
Definition RegistrationSetUnique.h:55
bool Register(RE::ActiveEffect *a_activeEffect)
bool Load(SerializationInterface *a_intfc)
bool Register(const void *a_object, RE::FormID a_formID, RE::VMTypeID a_typeID)
void Revert(SerializationInterface *)
RegistrationSetUniqueBase & operator=(const RegistrationSetUniqueBase &a_rhs)
RegistrationSetUniqueBase(RegistrationSetUniqueBase &&a_rhs)
std::recursive_mutex Lock
Definition RegistrationSetUnique.h:47
bool Unregister(RE::FormID a_uniqueID)
RegistrationSetUniqueBase(const std::string_view &a_eventName)
bool Unregister(RE::VMHandle a_handle)
bool Save(SerializationInterface *a_intfc)
std::lock_guard< Lock > Locker
Definition RegistrationSetUnique.h:48
bool Unregister(RE::TESForm *a_form)
RegistrationSetUniqueBase()=delete
bool Save(SerializationInterface *a_intfc, std::uint32_t a_type, std::uint32_t a_version)
Definition RegistrationSetUnique.h:59
Definition RegistrationTraits.h:45
Definition Interfaces.h:71
BSScript::IFunctionArguments * MakeFunctionArguments()
Definition FunctionArguments.h:86
std::uint32_t FormID
Definition BSCoreTypes.h:5
std::uint32_t VMTypeID
Definition BSCoreTypes.h:9
std::uint64_t VMHandle
Definition BSCoreTypes.h:7
const TaskInterface * GetTaskInterface() noexcept
Definition ActorValueList.h:28
Definition RegistrationTraits.h:40