mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-17 09:15:28 +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,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>();
|
||||
|
||||
Reference in New Issue
Block a user