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:
Aaron Kimbrell
2026-11-10 13:06:27 -06:00
parent f170b46a5e
commit 081e26ded8
6 changed files with 57 additions and 0 deletions

View File

@@ -1,5 +1,7 @@
#include "RacingMessages.h"
#include "CheatDetection.h"
#include "PossessorComponent.h"
#include "BitStreamUtils.h"
#include "CharacterComponent.h"
#include "Entity.h"
@@ -215,6 +217,21 @@ namespace GameMessages {
return;
}
// A player reports the pickups their own vehicle drove through
if (!CheatDetection::IsSendersPlayer(vehicle.GetObjectID(), sysAddr)) {
LOG("Object %llu (LOT %i) is not the vehicle of the player that reported a pickup for it", vehicle.GetObjectID(), vehicle.GetLOT());
return;
}
// Pickups are objects of a race track, and never a player, a vehicle or the zone's own object
const auto* const zoneControl = Game::zoneManager->GetZoneControlObject();
if (!zoneControl || !zoneControl->GetComponent<RacingControlComponent>()
|| pickup == zoneControl || pickup->IsPlayer()
|| pickup->GetComponent<PossessableComponent>() || pickup->GetComponent<PossessorComponent>()) {
LOG("Object %llu (LOT %i) is not a pickup of a race track", pickupObjID, pickup->GetLOT());
return;
}
// The sender is the vehicle; credit its driver if it has one.
Entity* entity = &vehicle;
auto* possessableComponent = entity->GetComponent<PossessableComponent>();