Add automatic quest start for Out of Time (MQ102) on COVault109 exit
When the player leaves COVault109 for the first time, the plugin now automatically starts the Out of Time quest (MQ102, FormID 0x0001CC2A) and sets it to stage 10, skipping the vault entry sequence for a smoother multiplayer transition. The implementation uses TESDataHandler::LookupForm to safely resolve the quest, includes defensive null checks, and only triggers once by checking the quest currentStage field. Appropriate logging is added for debugging. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+33
-4
@@ -668,6 +668,34 @@ namespace
|
||||
a_transform.angleZ));
|
||||
}
|
||||
|
||||
void TryStartOutOfTimeQuest()
|
||||
{
|
||||
constexpr auto MQ102_FORM_ID = 0x0001CC2A;
|
||||
constexpr auto MQ102_TARGET_STAGE = 10;
|
||||
|
||||
auto* dataHandler = RE::TESDataHandler::GetSingleton();
|
||||
if (!dataHandler) {
|
||||
LogWarningWithLocalPlayerPrefix("Failed to get data handler for quest initialization.");
|
||||
return;
|
||||
}
|
||||
|
||||
auto* quest = dataHandler->LookupForm<RE::TESQuest>(MQ102_FORM_ID, "Fallout4.esm");
|
||||
if (!quest) {
|
||||
LogWarningWithLocalPlayerPrefix("Failed to resolve MQ102 quest form.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (quest->currentStage != 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
quest->SetStage(MQ102_TARGET_STAGE);
|
||||
|
||||
LogInfoWithLocalPlayerPrefix(std::format(
|
||||
"Started quest MQ102 (Out of Time) and set to stage {}, triggered by leaving COVault109.",
|
||||
MQ102_TARGET_STAGE));
|
||||
}
|
||||
|
||||
const char* GetSpecialMovementType(
|
||||
const PlayerLocation& a_previousLocation,
|
||||
const PlayerLocation& a_currentLocation,
|
||||
@@ -766,10 +794,11 @@ namespace
|
||||
LogInfoWithLocalPlayerPrefix("COVault109 is a solo cell; sending entry location update before suppressing further transforms.");
|
||||
}
|
||||
|
||||
if (soloCellTransformSuppressed) {
|
||||
LogInfoWithLocalPlayerPrefix("Local player left solo cell; transform packet sending resumed.");
|
||||
soloCellTransformSuppressed = false;
|
||||
}
|
||||
if (soloCellTransformSuppressed) {
|
||||
LogInfoWithLocalPlayerPrefix("Local player left solo cell; transform packet sending resumed.");
|
||||
TryStartOutOfTimeQuest();
|
||||
soloCellTransformSuppressed = false;
|
||||
}
|
||||
|
||||
if (!hasLastTransform) {
|
||||
lastSentTransform = currentTransform;
|
||||
|
||||
Reference in New Issue
Block a user