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,5 +1,6 @@
|
||||
#include "CombatMessages.h"
|
||||
|
||||
#include "CheatDetection.h"
|
||||
#include "BitStreamUtils.h"
|
||||
#include "ControllablePhysicsComponent.h"
|
||||
#include "CppScripts.h"
|
||||
@@ -69,6 +70,13 @@ namespace GameMessages {
|
||||
|
||||
void RequestDie::Handle(Entity& entityRef, const SystemAddress& sysAddr) {
|
||||
Entity* entity = &entityRef;
|
||||
|
||||
// A player asks for their own death or that of the vehicle they drive
|
||||
if (!CheatDetection::IsSendersPlayer(entity->GetObjectID(), sysAddr)) {
|
||||
LOG("Object %llu (LOT %i) is not the player that asked for its death or their vehicle", entity->GetObjectID(), entity->GetLOT());
|
||||
return;
|
||||
}
|
||||
|
||||
auto* zoneController = Game::zoneManager->GetZoneControlObject();
|
||||
|
||||
auto* racingControlComponent = zoneController->GetComponent<RacingControlComponent>();
|
||||
@@ -103,6 +111,11 @@ namespace GameMessages {
|
||||
}
|
||||
|
||||
void RequestSmashPlayer::Handle(Entity& entity, const SystemAddress& sysAddr) {
|
||||
// A player asks for their own smash
|
||||
if (!entity.IsPlayer() || entity.GetSystemAddress() != sysAddr) {
|
||||
LOG("Object %llu (LOT %i) is not the player that asked for its smash", entity.GetObjectID(), entity.GetLOT());
|
||||
return;
|
||||
}
|
||||
entity.Smash(entity.GetObjectID());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user