From ceb374591fbe25eb21ae3db1029e080983d7f806 Mon Sep 17 00:00:00 2001 From: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> Date: Thu, 18 Aug 2022 19:42:52 -0700 Subject: [PATCH] Move mailbox closing to its script (#740) --- dGame/dGameMessages/GameMessages.cpp | 6 ------ dScripts/MailBoxServer.cpp | 8 ++++++++ dScripts/MailBoxServer.h | 1 + 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dGame/dGameMessages/GameMessages.cpp b/dGame/dGameMessages/GameMessages.cpp index 105bb526..1645afc8 100644 --- a/dGame/dGameMessages/GameMessages.cpp +++ b/dGame/dGameMessages/GameMessages.cpp @@ -4745,12 +4745,6 @@ void GameMessages::HandleFireEventServerSide(RakNet::BitStream* inStream, Entity return; } - if (args == u"toggleMail") { - AMFArrayValue args; - args.InsertValue("visible", new AMFFalseValue()); - GameMessages::SendUIMessageServerToSingleClient(entity, sysAddr, "ToggleMail", &args); - } - // This should probably get it's own "ServerEvents" system or something at some point if (args == u"ZonePlayer") { // Should probably check to make sure they're using a launcher at some point before someone makes a hack that lets you testmap diff --git a/dScripts/MailBoxServer.cpp b/dScripts/MailBoxServer.cpp index 81156835..c2534f3e 100644 --- a/dScripts/MailBoxServer.cpp +++ b/dScripts/MailBoxServer.cpp @@ -9,3 +9,11 @@ void MailBoxServer::OnUse(Entity* self, Entity* user) { args.InsertValue("state", value); GameMessages::SendUIMessageServerToSingleClient(user, user->GetSystemAddress(), "pushGameState", &args); } + +void MailBoxServer::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) { + if (args == "toggleMail") { + AMFArrayValue args; + args.InsertValue("visible", new AMFFalseValue()); + GameMessages::SendUIMessageServerToSingleClient(sender, sender->GetSystemAddress(), "ToggleMail", &args); + } +} diff --git a/dScripts/MailBoxServer.h b/dScripts/MailBoxServer.h index f459e8b3..9ada6a0e 100644 --- a/dScripts/MailBoxServer.h +++ b/dScripts/MailBoxServer.h @@ -12,4 +12,5 @@ public: * @param user The user that interacted with this Entity. */ void OnUse(Entity* self, Entity* user) override; + void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) override; };