mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-19 10:15: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:
@@ -12,6 +12,7 @@
|
||||
#include "InventoryMessages.h"
|
||||
#include "Item.h"
|
||||
#include "LootMetrics.h"
|
||||
#include "ObjectMessages.h"
|
||||
#include "QuickBuildComponent.h"
|
||||
#include "MissionComponent.h"
|
||||
#include "DestroyableComponent.h"
|
||||
@@ -233,7 +234,7 @@ TEST_F(LootMetricsTests, QuickbuildTakesItsCostAsTheSource) {
|
||||
quickBuild->SetCompleteTime(10.0f);
|
||||
ClearSent();
|
||||
|
||||
quickBuild->OnUse(entity.get());
|
||||
{ GameMessages::RequestUseEvent use(GameMessages::RequestUse{}, *entity); quickBuild->OnRequestUse(use); }
|
||||
EXPECT_EQ(quickBuild->GetState(), eQuickBuildState::BUILDING);
|
||||
const auto removed = Removed();
|
||||
ASSERT_EQ(removed.size(), 1u);
|
||||
|
||||
Reference in New Issue
Block a user