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:
Aaron Kimbrell
2026-10-01 07:55:55 -05:00
parent 50bfa623ca
commit 7a0dba22a5
33 changed files with 166 additions and 91 deletions

View File

@@ -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) {