Created
April 4, 2025 22:17
-
-
Save nickludlam/d411b5e19474d320ed9c2f6680625092 to your computer and use it in GitHub Desktop.
Arma Reforger conflict cap point speed calculations
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override void RefreshSeizingTimer() | |
{ | |
if (!m_fSeizingStartTimestamp) | |
return; | |
int servicesCount; | |
if (m_Base) | |
{ | |
array<SCR_EServicePointType> checkedTypes = { | |
SCR_EServicePointType.ARMORY, | |
SCR_EServicePointType.HELIPAD, | |
SCR_EServicePointType.BARRACKS, | |
SCR_EServicePointType.RADIO_ANTENNA, | |
SCR_EServicePointType.FIELD_HOSPITAL, | |
SCR_EServicePointType.LIGHT_VEHICLE_DEPOT, | |
SCR_EServicePointType.HEAVY_VEHICLE_DEPOT | |
}; | |
foreach (SCR_EServicePointType type : checkedTypes) | |
{ | |
if (m_Base.GetServiceDelegateByType(type)) | |
servicesCount++; | |
} | |
} | |
int radioConnectionsCount; | |
SCR_CoverageRadioComponent comp = SCR_CoverageRadioComponent.Cast(m_Base.GetOwner().FindComponent(SCR_CoverageRadioComponent)); | |
if (comp) | |
{ | |
SCR_CampaignFaction faction = m_Base.GetCampaignFaction(); | |
if (faction && faction.IsPlayable()) | |
radioConnectionsCount = comp.GetRadiosInRangeOfCount(faction.GetFactionRadioEncryptionKey()); | |
} | |
float seizingTimeVar = m_fMaximumSeizingTime - m_fMinimumSeizingTime; | |
float deduct; | |
if (m_iMaximumSeizingCharacters > 1) // Avoid division by 0 | |
{ | |
float deductPerPlayer = seizingTimeVar / (m_iMaximumSeizingCharacters - 1); | |
deduct = deductPerPlayer * (m_iSeizingCharacters - 1); | |
} | |
float multiplier = 1; | |
if ((m_fMaximumSeizingTime - m_fMinimumSeizingTime) > 0) | |
{ | |
multiplier += (servicesCount * (m_fExtraTimePerService / (m_fMaximumSeizingTime - m_fMinimumSeizingTime))); | |
multiplier += (radioConnectionsCount * (m_fExtraTimePerRadioConnection / (m_fMaximumSeizingTime - m_fMinimumSeizingTime))); | |
} | |
m_fSeizingEndTimestamp = m_fSeizingStartTimestamp.PlusSeconds(multiplier * (m_fMaximumSeizingTime - deduct)); | |
ChimeraWorld world = GetGame().GetWorld(); | |
WorldTimestamp currentTime = world.GetServerTimestamp(); | |
// Add a tiny delay if removing a service would cause immediate capture | |
if (m_fSeizingEndTimestamp.LessEqual(currentTime)) | |
m_fSeizingEndTimestamp = currentTime.PlusMilliseconds(SCR_GameModeCampaign.DEFAULT_DELAY); | |
if (m_bGradualTimerReset && m_fInterruptedCaptureDuration != 0) | |
HandleGradualReset(); | |
Replication.BumpMe(); | |
OnSeizingTimestampChanged(); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment