mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-11-17 01:05:28 +00:00
fix: a rail that is off or whose preconditions fail is not ridden
LWORailActivatorComponent::msgCheckUseRequirements (0x00c2c5b0) refuses a use, after the quick build check, when the row's preconditions fail or rail_activator_active is off, so a client does not ask. The server started the rail on any use request. The rows ask for an equipped item (44) or a completed mission (283 to 286). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "CombatMessages.h"
|
||||
#include "MovementMessages.h"
|
||||
#include "QuickBuildComponent.h"
|
||||
#include "Preconditions.h"
|
||||
#include "Game.h"
|
||||
#include "Logger.h"
|
||||
#include "RenderComponent.h"
|
||||
@@ -42,6 +43,7 @@ void RailActivatorComponent::LoadDataFromTemplate() {
|
||||
m_ShowNameBillboard = tableData.showNameBillboard;
|
||||
m_CameraLocked = tableData.cameraLocked;
|
||||
m_CollisionEnabled = tableData.playerCollision;
|
||||
m_Preconditions = tableData.preconditions;
|
||||
}
|
||||
|
||||
// The level config: a key, when there, replaces the row's value, as StartRailMovement's flags replace the row's in
|
||||
@@ -71,6 +73,11 @@ bool RailActivatorComponent::OnRequestUse(GameMessages::RequestUseEvent& event)
|
||||
if (quickBuildComponent != nullptr && quickBuildComponent->GetState() != eQuickBuildState::COMPLETED)
|
||||
return true;
|
||||
|
||||
// LWORailActivatorComponent::msgCheckUseRequirements (0x00c2c5b0): after the quick build, the row's preconditions
|
||||
// have to pass and the rail has to be on; the client does not send a use otherwise ("-1": the table has none)
|
||||
if (!m_Active) return true;
|
||||
if (!m_Preconditions.empty() && m_Preconditions != "-1" && !PreconditionExpression(m_Preconditions).Check(originator)) return true;
|
||||
|
||||
if (quickBuildComponent != nullptr) {
|
||||
// Don't want it to be destroyed while a player is using it
|
||||
quickBuildComponent->SetResetTime(quickBuildComponent->GetResetTime() + 10.0f);
|
||||
|
||||
Reference in New Issue
Block a user