4 [
Attribute(
"3",
desc:
"Set faction of user that can use the action, will be ignored if non are selected. Requires a 'FactionAffiliationComponent' on the Owner or parent. It will always allow interaction if user does not have 'FactionAffiliationComponent'. Default faction is the faction associated with the Initial Owner faction. Flags are checked in order. DISALLOW ON NULL is only checked when Default faction check is not set.", uiwidget: UIWidgets.Flags, enums: ParamEnumArray.FromEnum(
EActionFactionUsage),
category:
"Faction Settings")]
7 [
Attribute(
"#AR-ActionInvalid_HostileFaction",
desc:
"Faction invalid faction for the user that tries to use the action (By default this means faction is hostile, replace if there is a diffrent meaning)")]
10 [
Attribute(
"0",
desc:
"If entity itself does not have faction affiliation component then it will try to get the parents faction affiliation component if this is true")]
11 protected bool m_bAllowGetFactionOfParent;
13 protected FactionAffiliationComponent m_OwnerFactionAffiliation;
16 override protected bool CanBePerformedScript(IEntity user)
19 if (!IsFactionValid(user))
21 m_sCannotPerformReason = m_sInvalidFactionCannotPerform;
27 m_sCannotPerformReason =
string.Empty;
33 protected bool IsFactionValid(IEntity user)
39 FactionAffiliationComponent userFactionAffiliation = FactionAffiliationComponent.Cast(user.FindComponent(FactionAffiliationComponent));
42 if (!userFactionAffiliation)
46 Faction userFaction = userFactionAffiliation.GetAffiliatedFaction();
56 ownerFaction = m_OwnerFactionAffiliation.GetAffiliatedFaction();
76 ownerFaction = m_OwnerFactionAffiliation.GetDefaultAffiliatedFaction();
97 override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
99 m_OwnerFactionAffiliation = FactionAffiliationComponent.Cast(
GetOwner().FindComponent(FactionAffiliationComponent));
101 if (!m_OwnerFactionAffiliation && m_bAllowGetFactionOfParent &&
GetOwner().GetParent())
102 m_OwnerFactionAffiliation = FactionAffiliationComponent.Cast(
GetOwner().GetParent().FindComponent(FactionAffiliationComponent));