mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-17 09:15:28 +00:00
refactor(component): use is a RequestUse message handler
Components no longer have a virtual OnUse; each component that reacts to a use registers a RequestUse handler, like the client's components. The entity runs the INTERACT trigger and the script, then delivers a RequestUseEvent (carrying the user) to the handlers. The mission choice of a multi-interact use goes only to the mission offer, as before. Switches keep a direct EnterIfResponding for touches and pets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "PropertyVendorComponent.h"
|
||||
#include "ObjectMessages.h"
|
||||
|
||||
#include "PropertyMessages.h"
|
||||
#include "GameMessages.h"
|
||||
@@ -11,10 +12,13 @@
|
||||
#include "UserManager.h"
|
||||
|
||||
PropertyVendorComponent::PropertyVendorComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||
RegisterMsg(&PropertyVendorComponent::OnRequestUse);
|
||||
}
|
||||
|
||||
void PropertyVendorComponent::OnUse(Entity* originator) {
|
||||
if (PropertyManagementComponent::Instance() == nullptr) return;
|
||||
bool PropertyVendorComponent::OnRequestUse(GameMessages::RequestUseEvent& event) {
|
||||
if (event.msg.IsMissionChoice()) return false;
|
||||
auto* const originator = event.user;
|
||||
if (PropertyManagementComponent::Instance() == nullptr) return true;
|
||||
|
||||
OnQueryPropertyData(originator, originator->GetSystemAddress());
|
||||
|
||||
@@ -25,8 +29,9 @@ void PropertyVendorComponent::OnUse(Entity* originator) {
|
||||
msg.target = m_Parent->GetObjectID();
|
||||
msg.Send(originator->GetSystemAddress());
|
||||
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void PropertyVendorComponent::OnQueryPropertyData(Entity* originator, const SystemAddress& sysAddr) {
|
||||
|
||||
Reference in New Issue
Block a user