mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 17:54:01 +00:00
fix: not exiting shooting gallery when clicking activity close button
Fixes #436 Fixes crash when replaying as well
This commit is contained in:
@@ -1485,6 +1485,12 @@ void Entity::OnChoiceBoxResponse(Entity* sender, int32_t button, const std::u16s
|
||||
}
|
||||
}
|
||||
|
||||
void Entity::RequestActivityExit(Entity* sender, LWOOBJID player, bool canceled) {
|
||||
for (CppScripts::Script* script : CppScripts::GetEntityScripts(this)) {
|
||||
script->OnRequestActivityExit(sender, player, canceled);
|
||||
}
|
||||
}
|
||||
|
||||
void Entity::Smash(const LWOOBJID source, const eKillType killType, const std::u16string& deathType) {
|
||||
if (!m_PlayerIsReadyForUpdates) return;
|
||||
|
||||
|
@@ -207,6 +207,7 @@ public:
|
||||
|
||||
void OnMessageBoxResponse(Entity* sender, int32_t button, const std::u16string& identifier, const std::u16string& userData);
|
||||
void OnChoiceBoxResponse(Entity* sender, int32_t button, const std::u16string& buttonIdentifier, const std::u16string& identifier);
|
||||
void RequestActivityExit(Entity* sender, LWOOBJID player, bool canceled);
|
||||
|
||||
void Smash(const LWOOBJID source = LWOOBJID_EMPTY, const eKillType killType = eKillType::VIOLENT, const std::u16string& deathType = u"");
|
||||
void Kill(Entity* murderer = nullptr);
|
||||
|
@@ -677,6 +677,9 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
||||
case eGameMessageType::ZONE_SUMMARY_DISMISSED:
|
||||
GameMessages::HandleZoneSummaryDismissed(inStream, entity);
|
||||
break;
|
||||
case eGameMessageType::REQUEST_ACTIVITY_EXIT:
|
||||
GameMessages::HandleRequestActivityExit(inStream, entity);
|
||||
break;
|
||||
default:
|
||||
// Game::logger->Log("GameMessageHandler", "Unknown game message ID: %i", messageID);
|
||||
break;
|
||||
|
@@ -91,6 +91,7 @@
|
||||
#include "eReplicaComponentType.h"
|
||||
#include "eClientMessageType.h"
|
||||
#include "eGameMessageType.h"
|
||||
#include "ActivityManager.h"
|
||||
|
||||
#include "CDComponentsRegistryTable.h"
|
||||
#include "CDObjectsTable.h"
|
||||
@@ -6204,3 +6205,18 @@ void GameMessages::SendShowBillboardInteractIcon(const SystemAddress& sysAddr, L
|
||||
if (sysAddr == UNASSIGNED_SYSTEM_ADDRESS) SEND_PACKET_BROADCAST
|
||||
else SEND_PACKET
|
||||
}
|
||||
|
||||
void GameMessages::HandleRequestActivityExit(RakNet::BitStream* inStream, Entity* entity) {
|
||||
bool canceled = false;
|
||||
inStream->Read(canceled);
|
||||
if (!canceled) return;
|
||||
|
||||
LWOOBJID player_id = LWOOBJID_EMPTY;
|
||||
inStream->Read(player_id);
|
||||
auto player = EntityManager::Instance()->GetEntity(player_id);
|
||||
if (!entity || !player) return;
|
||||
|
||||
for (auto* shootingGallery : EntityManager::Instance()->GetEntitiesByComponent(eReplicaComponentType::SHOOTING_GALLERY)) {
|
||||
shootingGallery->RequestActivityExit(entity, player_id, true);
|
||||
}
|
||||
}
|
||||
|
@@ -648,6 +648,7 @@ namespace GameMessages {
|
||||
void SendDeactivateBubbleBuffFromServer(LWOOBJID objectId, const SystemAddress& sysAddr);
|
||||
|
||||
void HandleZoneSummaryDismissed(RakNet::BitStream* inStream, Entity* entity);
|
||||
void HandleRequestActivityExit(RakNet::BitStream* inStream, Entity* entity);
|
||||
};
|
||||
|
||||
#endif // GAMEMESSAGES_H
|
||||
|
Reference in New Issue
Block a user