mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-20 10:45: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:
@@ -28,6 +28,7 @@ namespace GameMessages {
|
||||
struct GetFlag;
|
||||
struct GetFactionTokenType;
|
||||
struct PickupItem;
|
||||
struct RequestUse;
|
||||
struct ChildRemoved;
|
||||
};
|
||||
|
||||
@@ -247,6 +248,10 @@ public:
|
||||
void NotifyObject(Entity* sender, const std::string& name, int32_t param1 = 0, int32_t param2 = 0);
|
||||
void OnEmoteReceived(int32_t emote, Entity* target);
|
||||
|
||||
// The client's RequestUse of this object by user: the INTERACT trigger and the script's OnUse (not for the mission
|
||||
// choice of a multi-interact use), then the components' RequestUse handlers.
|
||||
void RequestUse(const GameMessages::RequestUse& msg, Entity& user);
|
||||
// originator uses this object as if their client had sent RequestUse
|
||||
void OnUse(Entity* originator);
|
||||
|
||||
void OnHitOrHealResult(Entity* attacker, int32_t damage);
|
||||
|
||||
Reference in New Issue
Block a user