7 static override bool DependsOn(
string className)
9 return className.ToType().IsInherited(FactionAffiliationComponent);
14 return {FactionAffiliationComponent};
21 protected int m_iRadius;
23 [
Attribute(
"0",
desc:
"Not all capture points controlled are required for seizing this base, only the majority.")]
24 protected bool m_bSeizedByMajority;
27 protected bool m_bShowNotifications;
30 protected bool m_bShowMapIcon;
38 static const int INVALID_BASE_CALLSIGN = -1;
40 protected int m_iCallsignSignal = INVALID_BASE_CALLSIGN;
42 protected string m_sCallsign;
43 protected string m_sCallsignUpper;
44 protected string m_sCallsignNameOnly;
45 protected string m_sCallsignNameOnlyUC;
51 protected ref array<SCR_MilitaryBaseLogicComponent> m_aSystems = {};
57 [
RplProp(onRplName:
"OnCapturingFactionChanged")]
60 [
RplProp(onRplName:
"OnCallsignAssigned")]
95 m_bShowNotifications = allow;
103 return m_bShowNotifications;
128 if (!m_OnRadiusChanged)
131 return m_OnRadiusChanged;
138 if (!m_OnServiceRegistered)
141 return m_OnServiceRegistered;
148 if (!m_OnServiceUnregistered)
151 return m_OnServiceUnregistered;
161 SCR_MilitaryBaseCallsign callsignInfo = faction.GetBaseCallsignByIndex(
m_iCallsign);
166 m_sCallsign = callsignInfo.GetCallsign();
167 m_sCallsignNameOnly = callsignInfo.GetCallsignShort();
168 m_sCallsignNameOnlyUC = callsignInfo.GetCallsignUpperCase();
169 m_iCallsignSignal = callsignInfo.GetSignalIndex();
184 return m_iCallsignSignal;
198 PlayerController pc =
GetGame().GetPlayerController();
203 if (!playerFactionAff)
223 return m_sCallsignNameOnly;
237 return m_sCallsignNameOnlyUC;
244 return m_sCallsignUpper;
251 int GetServices(out array<SCR_ServicePointComponent> services = null)
255 foreach (SCR_MilitaryBaseLogicComponent component : m_aSystems)
257 SCR_ServicePointComponent service = SCR_ServicePointComponent.Cast(component);
264 services.Insert(service);
279 foreach (SCR_MilitaryBaseLogicComponent component : m_aSystems)
281 SCR_ServicePointComponent service = SCR_ServicePointComponent.Cast(component);
283 if (service && service.GetType() ==
type)
288 services.Insert(service);
300 foreach (SCR_MilitaryBaseLogicComponent component : m_aSystems)
302 SCR_ServicePointComponent service = SCR_ServicePointComponent.Cast(component);
304 if (service && service.GetLabel() == label)
316 foreach (SCR_MilitaryBaseLogicComponent component : m_aSystems)
318 SCR_ServicePointComponent service = SCR_ServicePointComponent.Cast(component);
320 if (service && service.GetType() ==
type)
341 delegates.Insert(delegate);
358 if (delegate && delegate.GetType() ==
type)
363 delegates.Insert(delegate);
377 if (delegate && delegate.GetLabel() == label)
391 if (delegate && delegate.GetType() ==
type)
403 SCR_CampaignBuildingProviderComponent provider;
407 foreach (SCR_MilitaryBaseLogicComponent component : m_aSystems)
409 provider = SCR_CampaignBuildingProviderComponent.Cast(component);
416 providers.Insert(provider);
431 foreach (SCR_MilitaryBaseLogicComponent component : m_aSystems)
440 capturePoints.Insert(capturePoint);
455 foreach (SCR_MilitaryBaseLogicComponent component : m_aSystems)
457 SCR_FlagComponent flag = SCR_FlagComponent.Cast(component);
478 if (radius == m_iRadius)
483 Print(
"SCR_MilitaryBaseComponent: SetRadius called with suspicious value (" + radius +
").",
LogLevel.WARNING);
496 if (m_OnRadiusChanged)
497 m_OnRadiusChanged.Invoke(m_iRadius,
this);
542 foreach (SCR_MilitaryBaseLogicComponent comp : m_aSystems)
547 comp.OnBaseFactionChanged(faction);
556 if (m_bShowNotifications)
570 if (!faction && checkDefaultFaction)
580 FactionManager fManager =
GetGame().GetFactionManager();
619 if (m_aSystems.Contains(component))
622 m_aSystems.Insert(component);
624 SCR_ServicePointComponent service = SCR_ServicePointComponent.Cast(component);
628 if (m_OnServiceRegistered)
629 m_OnServiceRegistered.Invoke(
this, service);
637 SCR_FlagComponent flag = SCR_FlagComponent.Cast(component);
646 if (seizingComponent)
663 if (!m_aSystems.Contains(component))
666 m_aSystems.RemoveItem(component);
668 SCR_ServicePointComponent service = SCR_ServicePointComponent.Cast(component);
674 if (service && baseManager)
678 if (m_OnServiceUnregistered)
679 m_OnServiceUnregistered.Invoke(
this, service);
686 if (seizingComponent)
707 array<SCR_SeizingComponent> capturePoints = {};
713 if (capturePoint == point || capturePoint.GetFaction() == faction)
718 if (pointsCount == controlled || (m_bSeizedByMajority && controlled > (pointsCount - controlled)))
731 array<SCR_SeizingComponent> capturePoints = {};
737 if (capturePoint.GetFaction() == faction)
742 if (controlled + 1 == pointsCount || (m_bSeizedByMajority && controlled + 1 > (pointsCount - controlled)))
758 array<SCR_SeizingComponent> capturePoints = {};
764 if (capturePoint.GetFaction() == faction)
769 if (controlled + 1 == pointsCount || (m_bSeizedByMajority && controlled + 1 > (pointsCount - controlled)))
788 foreach (SCR_MilitaryBaseLogicComponent comp : m_aSystems)
815 array<SCR_FlagComponent>
flags = {};
818 foreach (SCR_FlagComponent flagComponent :
flags)
854 if (playerFaction == faction)
855 SCR_NotificationsComponent.SendLocal(m_eCapturedByFriendliesNotification);
857 SCR_NotificationsComponent.SendLocal(m_eCapturedByEnemiesNotification);
863 super.EOnInit(owner);
878 super.OnPostInit(owner);
885 Print(
"SCR_MilitaryBaseComponent: RplComponent not found on owner entity. Multiplayer functionality will not be available.",
LogLevel.WARNING);
888 Print(
"SCR_MilitaryBaseComponent: SCR_FactionAffiliationComponent not found on owner entity. Faction handling will not be available.",
LogLevel.WARNING);
892 Print(
"SCR_MilitaryBaseComponent: m_iRadius set to suspicious value (" + m_iRadius +
").",
LogLevel.WARNING);
912 foreach (SCR_MilitaryBaseLogicComponent component : m_aSystems)
915 component.UnregisterBase(
this);
SCR_EAIThreatSectorFlags flags
ArmaReforgerScripted GetGame()
FactionAffiliationComponent m_FactionComponent
SCR_CacheNoteComponentClass ScriptComponentClass RplProp()] protected ref array< string > m_aLines
void OnFactionChanged(Faction faction)
RplComponent m_RplComponent
override void OnServiceStateChanged(SCR_EServicePointStatus state, notnull SCR_ServicePointComponent serviceComponent)
override void SetCallsign(notnull SCR_Faction faction)
override void OnCapturingFactionChanged()
Event which is triggered when the capturing faction changes.
override void SetCallsignIndexAutomatic(int index)
void SetFaction(SCR_CampaignFaction faction)
override void RegisterLogicComponent(notnull SCR_MilitaryBaseLogicComponent component)
SCR_CampaignFaction GetFaction()
SCR_DestructionSynchronizationComponentClass ScriptComponentClass int index
void SCR_FactionManager(IEntitySource src, IEntity parent)
void RegisterServiceDelegate(notnull SCR_ServicePointDelegateComponent delegate)
LocalizedString GetCallsignDisplayName()
Faction GetCapturingFaction()
ScriptInvokerServiceUnregistered GetOnServiceUnregistered()
void OnCallsignAssigned()
int GetServiceDelegatesByType(out array< SCR_ServicePointDelegateComponent > delegates, SCR_EServicePointType type)
SCR_ServicePointComponent GetServiceByType(SCR_EServicePointType type)
ScriptInvoker GetOnServiceRegistered()
void OnPlayerFactionChanged(SCR_PlayerFactionAffiliationComponent component, Faction previous, Faction current)
void SetCallsignIndex(int index)
void SetRadius(int radius)
void OnRequiredPointsCaptured(notnull SCR_Faction faction)
int GetServices(out array< SCR_ServicePointComponent > services=null)
int GetServiceDelegates(out array< SCR_ServicePointDelegateComponent > delegates=null)
LocalizedString GetCallsignDisplayNameOnly()
bool GetIsEntityPresent(notnull IEntity entity)
bool NotificationsAllowed()
ScriptInvoker GetOnRadiusChanged()
ScriptInvokerBase< ScriptInvokerServiceUnregisteredMethod > ScriptInvokerServiceUnregistered
int GetBuildingProviders(out array< SCR_CampaignBuildingProviderComponent > providers)
Get all registered systems inherited from SCR_CampaignBuildingProviderComponent.
int GetServicesByType(out array< SCR_ServicePointComponent > services, SCR_EServicePointType type)
ScriptInvoker GetOnMilitaryBaseUnregistered()
SCR_ServicePointDelegateComponent GetServiceDelegateByLabel(EEditableEntityLabel label)
void UnregisterServiceDelegate(notnull SCR_ServicePointDelegateComponent delegate)
void OnPointContested(notnull SCR_Faction faction, notnull SCR_SeizingComponent point)
void ChangeFlags(notnull Faction faction)
SCR_ServicePointComponent GetServiceByLabel(EEditableEntityLabel label)
int GetCapturePoints(out array< SCR_SeizingComponent > capturePoints)
SCR_ServicePointDelegateComponent GetServiceDelegateByType(SCR_EServicePointType type)
ref array< SCR_ServicePointDelegateComponent > m_aServiceDelegates
void NotifyPlayerInRadius(notnull Faction faction)
void UnregisterLogicComponent(notnull SCR_MilitaryBaseLogicComponent component)
func ScriptInvokerServiceUnregisteredMethod
void OnPointSecured(notnull SCR_Faction faction, notnull SCR_SeizingComponent point)
int GetFlags(out array< SCR_FlagComponent > flags)
ScriptInvoker GetOnMilitaryBaseRegistered()
void AllowNotifications(bool allow)
LocalizedString GetCallsignDisplayNameOnlyUC()
LocalizedString GetCallsignDisplayNameUpperCase()
FactionKey m_sCapturingFaction
bool GetIsLocalPlayerPresent()
ref ScriptInvoker< SCR_MilitaryBaseLogicComponent > m_OnMilitaryBaseUnregistered
ref ScriptInvoker< SCR_MilitaryBaseLogicComponent > m_OnMilitaryBaseRegistered
void OnPointCaptured(notnull SCR_Faction faction, notnull SCR_SeizingComponent point)
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
proto external Managed FindComponent(typename typeName)
ResourceName GetFactionFlagMaterial()
void OnLogicUnregisteredInBase(SCR_MilitaryBaseLogicComponent logic, SCR_MilitaryBaseComponent base)
void RegisterBase(notnull SCR_MilitaryBaseComponent base)
void UnregisterBase(notnull SCR_MilitaryBaseComponent base)
static SCR_MilitaryBaseSystem GetInstance()
void OnBaseFactionChanged(Faction faction, SCR_MilitaryBaseComponent base)
void OnLogicRegisteredInBase(SCR_MilitaryBaseLogicComponent logic, SCR_MilitaryBaseComponent base)
static int GetLocalPlayerId()
Returns either a valid ID of local player or 0.
OnPlayerFactionChangedInvoker GetOnPlayerFactionChangedInvoker()
ScriptInvoker GetOnCaptureStart()
ScriptInvoker GetOnCaptureFinish()
ScriptInvoker GetOnCaptureInterrupt()
IEntity GetOwner()
Owner entity of the fuel tank.
override void EOnInit(IEntity owner)
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
SCR_FieldOfViewSettings Attribute
EntityEvent
Various entity events.