mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-16 00:35:27 +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 "PropertyManagementComponent.h"
|
||||
#include "ObjectMessages.h"
|
||||
#include "PropertyRent.h"
|
||||
#include "ChatPackets.h"
|
||||
#include "DashboardNotify.h"
|
||||
@@ -41,6 +42,7 @@
|
||||
PropertyManagementComponent* PropertyManagementComponent::instance = nullptr;
|
||||
|
||||
PropertyManagementComponent::PropertyManagementComponent(Entity* parent, const int32_t componentID) : Component(parent, componentID) {
|
||||
RegisterMsg(&PropertyManagementComponent::OnRequestUse);
|
||||
this->owner = LWOOBJID_EMPTY;
|
||||
this->templateId = 0;
|
||||
this->propertyId = LWOOBJID_EMPTY;
|
||||
@@ -978,11 +980,14 @@ void PropertyManagementComponent::SendPropertyData(const Entity& player, const G
|
||||
forPlayer.Send(player.GetSystemAddress());
|
||||
}
|
||||
|
||||
void PropertyManagementComponent::OnUse(Entity* originator) {
|
||||
bool PropertyManagementComponent::OnRequestUse(GameMessages::RequestUseEvent& event) {
|
||||
if (event.msg.IsMissionChoice()) return false;
|
||||
auto* const originator = event.user;
|
||||
OnQueryPropertyData(originator, UNASSIGNED_SYSTEM_ADDRESS);
|
||||
GameMessages::OpenPropertyManagement msg;
|
||||
msg.target = PropertyManagementComponent::Instance()->GetParent()->GetObjectID();
|
||||
msg.Send(originator->GetSystemAddress());
|
||||
return true;
|
||||
}
|
||||
|
||||
void PropertyManagementComponent::SetOwnerId(const LWOOBJID value) {
|
||||
|
||||
Reference in New Issue
Block a user