mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-16 16:55: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:
@@ -7,6 +7,7 @@
|
||||
#include "Entity.h"
|
||||
#include "PlayerMessages.h"
|
||||
#include "dZoneManager.h"
|
||||
#include "ObjectMessages.h"
|
||||
#include "QuickBuildComponent.h"
|
||||
#include "QuickBuildMessages.h"
|
||||
#include "eQuickBuildState.h"
|
||||
@@ -60,7 +61,7 @@ protected:
|
||||
|
||||
// Starts the build and runs updates until it completes (the first update only sets up the imagination drain).
|
||||
std::vector<CapturedPacket> Build() {
|
||||
quickBuild->OnUse(player.get());
|
||||
{ GameMessages::RequestUseEvent use(GameMessages::RequestUse{}, *player); quickBuild->OnRequestUse(use); }
|
||||
return Capture([&] {
|
||||
for (int i = 0; i < 3 && quickBuild->GetState() != eQuickBuildState::COMPLETED; i++) quickBuild->Run(0.1f);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user