mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-16 16:55:27 +00:00
fix: a player's own messages have to be sent for that player
The die request, the smash request, the loaded notice, chat commands and the racing pickup notice were handled for whichever object they named. They are now only handled for the player that sent them, or for the vehicle that player drives where the client sends them for it. A racing pickup also has to be an object of a race track that is not a player, a vehicle or the zone's own object. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "ZoneMessages.h"
|
||||
#include "Logger.h"
|
||||
#include "MovementMessages.h"
|
||||
#include "MissionMessages.h"
|
||||
|
||||
@@ -63,6 +64,11 @@ namespace GameMessages {
|
||||
|
||||
void PlayerLoaded::Handle(Entity& entityRef, const SystemAddress& sysAddr) {
|
||||
auto* entity = &entityRef;
|
||||
// A player reports that they themselves have loaded
|
||||
if (!entity->IsPlayer() || entity->GetSystemAddress() != sysAddr) {
|
||||
LOG("Object %llu (LOT %i) is not the player that reported it as loaded", entity->GetObjectID(), entity->GetLOT());
|
||||
return;
|
||||
}
|
||||
const auto* const zoneControlEntity = Game::entityManager->GetZoneControlEntity();
|
||||
SendPlayerReady(entity->GetObjectID(), zoneControlEntity ? zoneControlEntity->GetObjectID() : LWOOBJID_EMPTY, sysAddr);
|
||||
entity->SetPlayerReadyForUpdates();
|
||||
|
||||
Reference in New Issue
Block a user