Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_CampaignBuildingProviderComponent.c
Go to the documentation of this file.
1 [EntityEditorProps(category: "GameScripted/Building", description: "Component attached to a provider, responsible for basic provider behaviour.")]
3 {
4 }
5 
6 class SCR_CampaignBuildingProviderComponent : SCR_MilitaryBaseLogicComponent
7 {
8  [Attribute("", UIWidgets.EditBox, "Name of provider shown in provider interface", "")]
9  protected string m_sProviderDisplayName;
10 
11  [Attribute("0", UIWidgets.CheckBox, "Can the building mode at this provider executed only via user action?")]
13 
14  [Attribute("0", UIWidgets.CheckBox, "Master provider is for example HQ with other service (providers) in vicinity.")]
15  protected bool m_bIsMasterProvider;
16 
17  [Attribute("0", UIWidgets.CheckBox, "When opening a Free Roam Building mode, try to use master provider. Master provider is HQ where the service is registered in.")]
18  protected bool m_bUseMasterProvider;
19 
20  [Attribute("0", UIWidgets.CheckBox, "Register at nearby base, if available.")]
21  protected bool m_bRegisterAtBase;
22 
23  [Attribute("0", UIWidgets.CheckBox, "If set, player can command friendly AI in building radius.")]
24  protected bool m_bCanCommandAI;
25 
26  [Attribute("1", UIWidgets.CheckBox, "Obstruct view when an enemy is present within the radius of the building.")]
28 
29  [Attribute("50", UIWidgets.EditBox, "Building radius")]
30  protected float m_fBuildingRadius;
31 
32  [Attribute(defvalue: "1", uiwidget: UIWidgets.ComboBox, desc: "Minimal rank that allows player to use the provider to build structures.", enums: ParamEnumArray.FromEnum(SCR_ECharacterRank))]
34 
35  [Attribute(desc: "Fill in the budgets to be used with this provider")]
36  protected ref array<ref SCR_CampaignBuildingBudgetToEvaluateData> m_aBudgetsToEvaluate;
37 
38  [Attribute(desc: "Traits this provider will provide. Each trait represents a tab in building interface. The tabs have to be defined in building mode's SCR_ContentBrowserEditorComponent.", UIWidgets.ComboBox, enums: ParamEnumArray.FromEnum(EEditableEntityLabel))]
39  protected ref array<EEditableEntityLabel> m_aAvailableTraits;
40 
42  [RplProp()]
43  protected int m_iCurrentPropValue;
44 
46  [RplProp()]
47  protected int m_iCurrentAIValue;
48 
49  protected Physics m_ProviderPhysics;
50 
51  protected SCR_ResourceComponent m_ResourceComponent;
52 
53  protected ref array<int> m_aActiveUsersIDs = {};
54  protected ref array<int> m_aAvailableUsersIDs = {};
55  protected ref array<SCR_CampaignBuildingBudgetToEvaluateData> m_aShownBudget = {};
56 
57  protected static ref ScriptInvokerVoid s_OnProviderCreated = new ScriptInvokerVoid();
59 
60  protected const int MOVING_CHECK_PERIOD = 1000;
61  protected const int PROVIDER_SPEED_TO_REMOVE_BUILDING_SQ = 1;
62 
63  protected ref array<ref Tuple2<int, WorldTimestamp>> m_aPlacingCooldown = {};
64  protected bool m_bCooldownClientLock;
65 
66  SCR_CampaignBuildingProviderComponent m_MasterProviderComponent;
67 
68  //------------------------------------------------------------------------------------------------
71  {
72  return m_sProviderDisplayName;
73  }
74 
75  //------------------------------------------------------------------------------------------------
78  {
79  return m_bUseMasterProvider;
80  }
81 
82  //------------------------------------------------------------------------------------------------
85  {
86  return m_bIsMasterProvider;
87  }
88 
89  //------------------------------------------------------------------------------------------------
91  bool CanCommandAI()
92  {
93  return m_bCanCommandAI;
94  }
95 
96  //------------------------------------------------------------------------------------------------
99  {
101  }
102 
103  //------------------------------------------------------------------------------------------------
106  {
107  // Check bases this service is registered to. If non, it's standalone, return itself.
108  array<SCR_MilitaryBaseComponent> bases = {};
109  array<SCR_CampaignBuildingProviderComponent> providers = {};
110 
111  GetBases(bases);
112 
113  foreach (SCR_MilitaryBaseComponent base : bases)
114  {
115  base.GetBuildingProviders(providers);
116 
117  foreach (SCR_CampaignBuildingProviderComponent provider : providers)
118  {
119  if (provider.IsMasterProvider())
120  return provider.GetOwner();
121  }
122  }
123 
124  return GetOwner();
125  }
126 
127  //------------------------------------------------------------------------------------------------
129  bool UseMasterProviderBudget(EEditableEntityBudget budget, out SCR_CampaignBuildingProviderComponent masterProviderComponent)
130  {
131  if (!m_aBudgetsToEvaluate || m_aBudgetsToEvaluate.IsEmpty())
132  return false;
133 
134  IEntity masterProvider;
135 
137  {
138  if (budgetData.GetBudget() == budget && budgetData.UseMasterProviderBudget())
139  {
140  masterProvider = GetMasterProviderEntity();
141  if (masterProvider == GetOwner())
142  return false;
143 
144  masterProviderComponent = SCR_CampaignBuildingProviderComponent.Cast(masterProvider.FindComponent(SCR_CampaignBuildingProviderComponent));
145  return true;
146  }
147  }
148 
149  return false;
150  }
151 
152  //------------------------------------------------------------------------------------------------
153  void SetClientLock(bool lock, IEntity provider, int playerId)
154  {
155  PlayerController playerController = GetGame().GetPlayerManager().GetPlayerController(playerId);
156  if (!playerController)
157  return;
158 
159  SCR_CampaignBuildingNetworkComponent buildingNetworkComponent = SCR_CampaignBuildingNetworkComponent.Cast(playerController.FindComponent(SCR_CampaignBuildingNetworkComponent));
160  if (!buildingNetworkComponent)
161  return;
162 
163  buildingNetworkComponent.SetClientLock(lock, provider);
164  }
165 
166  //------------------------------------------------------------------------------------------------
167  void SetCooldownClientLock(bool val)
168  {
169  m_bCooldownClientLock = val;
170 
172  m_OnCooldownLockUpdated.Invoke();
173  }
174 
175  //------------------------------------------------------------------------------------------------
177  void SetPlayerCooldown(int playerId, int cooldownTime)
178  {
179  ChimeraWorld world = GetOwner().GetWorld();
180  if (!world)
181  return;
182 
183  m_aPlacingCooldown.Insert(new Tuple2<int, WorldTimestamp>(playerId, world.GetServerTimestamp().PlusMilliseconds(CalculateCooldownTime(playerId, cooldownTime) * 1000)));
184 
185  SetClientLock(true, GetOwner(), playerId);
186  GetGame().GetCallqueue().CallLater(UpdateCooldownTimer, 250, true, null);
187  }
188 
189  //------------------------------------------------------------------------------------------------
192  {
193  ChimeraWorld world = GetOwner().GetWorld();
194  if (!world)
195  return;
196 
197  bool cooldownChange;
198 
199  for (int i = m_aPlacingCooldown.Count() - 1; i >= 0; i--)
200  {
201  if (!m_aPlacingCooldown[i].param2.Greater(world.GetServerTimestamp()))
202  {
203  SetClientLock(false, GetOwner(), m_aPlacingCooldown[i].param1);
204  m_aPlacingCooldown.Remove(i);
205  cooldownChange = true;
206  }
207  }
208 
209  if (m_OnCooldownLockUpdated && cooldownChange)
210  m_OnCooldownLockUpdated.Invoke();
211 
212  if (m_aPlacingCooldown.IsEmpty())
213  GetGame().GetCallqueue().Remove(UpdateCooldownTimer);
214  }
215 
216  //------------------------------------------------------------------------------------------------
218  bool HasCooldownSet(int playerId)
219  {
220  return m_bCooldownClientLock || !m_aPlacingCooldown.IsEmpty();
221  }
222 
223  //------------------------------------------------------------------------------------------------
225  float GetCooldownValue(int playerId)
226  {
227  float cooldown = 0.0;
228 
229  ChimeraWorld world = GetOwner().GetWorld();
230  if (!world)
231  return cooldown;
232 
233  foreach (Tuple2<int, WorldTimestamp> cooldownEntry : m_aPlacingCooldown)
234  {
235  if (cooldownEntry.param1 == playerId)
236  {
237  cooldown = cooldownEntry.param2.DiffMilliseconds(world.GetServerTimestamp()) * 0.001;
238  return cooldown;
239  }
240  }
241 
242  return cooldown;
243  }
244 
245  //------------------------------------------------------------------------------------------------
247  {
250 
252  }
253 
254  //------------------------------------------------------------------------------------------------
255  override void RegisterBase(notnull SCR_MilitaryBaseComponent base)
256  {
257  if (!m_bRegisterAtBase)
258  return;
259 
260  super.RegisterBase(base);
261  }
262 
263  //------------------------------------------------------------------------------------------------
266  {
267  return m_bRegisterAtBase;
268  }
269 
270  //------------------------------------------------------------------------------------------------
272  SCR_MilitaryBaseComponent GetMilitaryBaseComponent()
273  {
274  array<SCR_MilitaryBaseComponent> bases = {};
275  GetBases(bases);
276 
277  if (bases.IsEmpty())
278  return null;
279 
280  return bases[0];
281  }
282 
283  //------------------------------------------------------------------------------------------------
286  {
287  return m_iRank;
288  }
289 
290  //------------------------------------------------------------------------------------------------
293  {
294  return m_fBuildingRadius;
295  }
296 
297  //------------------------------------------------------------------------------------------------
300  {
302  if (!budgetData)
303  return -1;
304 
306  if (maxValueBudgetData)
307  return maxValueBudgetData.GetMaxValue();
308 
309  return -1;
310  }
311 
312  //------------------------------------------------------------------------------------------------
315  {
316  return m_iCurrentPropValue;
317  }
318 
319  //------------------------------------------------------------------------------------------------
321  void SetPropValue(int value)
322  {
323  m_iCurrentPropValue = value;
324 
325  SCR_CampaignBuildingProviderComponent masterProviderComponent;
326 
327  if (UseMasterProviderBudget(EEditableEntityBudget.PROPS, masterProviderComponent))
328  masterProviderComponent.SetPropValue(value);
329 
330  Replication.BumpMe();
331  }
332 
333  //------------------------------------------------------------------------------------------------
336  void AddPropValue(int value)
337  {
338  m_iCurrentPropValue += value;
339 
340  SCR_CampaignBuildingProviderComponent masterProviderComponent;
341 
342  if (UseMasterProviderBudget(EEditableEntityBudget.PROPS, masterProviderComponent))
343  masterProviderComponent.AddPropValue(value);
344 
345  Replication.BumpMe();
346  }
347 
348  //------------------------------------------------------------------------------------------------
350  {
351  SCR_CampaignBuildingProviderComponent masterProviderComponent;
352 
353  if (UseMasterProviderBudget(EEditableEntityBudget.AI, masterProviderComponent))
354  return masterProviderComponent.GetCurrentAIValue();
355 
356  return m_iCurrentAIValue;
357  }
358 
359  //------------------------------------------------------------------------------------------------
360  void SetAIValue(int value)
361  {
362  m_iCurrentAIValue = value;
363 
364  SCR_CampaignBuildingProviderComponent masterProviderComponent;
365 
366  if (UseMasterProviderBudget(EEditableEntityBudget.AI, masterProviderComponent))
367  masterProviderComponent.SetAIValue(value);
368 
369  Replication.BumpMe();
370  }
371 
372  //------------------------------------------------------------------------------------------------
373  void AddAIValue(int value)
374  {
375  m_iCurrentAIValue += value;
376 
377  SCR_CampaignBuildingProviderComponent masterProviderComponent;
378 
379  if (UseMasterProviderBudget(EEditableEntityBudget.AI, masterProviderComponent))
380  masterProviderComponent.AddAIValue(value);
381 
382  Replication.BumpMe();
383  }
384 
385  //------------------------------------------------------------------------------------------------
387  protected void OnAIRemoved(IEntity ent)
388  {
389  RemoveEvents(ent);
390  AddAIValue(-1);
391  }
392 
393  //------------------------------------------------------------------------------------------------
395  void SetOnEntityKilled(IEntity ent)
396  {
397  SCR_EditableCharacterComponent editableCharacter = SCR_EditableCharacterComponent.Cast(ent.FindComponent(SCR_EditableCharacterComponent));
398  if (!editableCharacter)
399  return;
400 
401  editableCharacter.GetOnDestroyed().Insert(OnAIRemoved);
402  editableCharacter.GetOnDeleted().Insert(OnAIRemoved);
403  }
404 
405  //------------------------------------------------------------------------------------------------
407  protected void RemoveEvents(IEntity ent)
408  {
409  SCR_EditableCharacterComponent editableCharacter = SCR_EditableCharacterComponent.Cast(ent.FindComponent(SCR_EditableCharacterComponent));
410  if (!editableCharacter)
411  return;
412 
413  editableCharacter.GetOnDestroyed().Remove(OnAIRemoved);
414  editableCharacter.GetOnDeleted().Remove(OnAIRemoved);
415  }
416 
417  //------------------------------------------------------------------------------------------------
418  array<EEditableEntityLabel> GetAvailableTraits()
419  {
420  array<EEditableEntityLabel> availableTraits = {};
421  availableTraits.Copy(m_aAvailableTraits);
422  return availableTraits;
423  }
424 
425  //------------------------------------------------------------------------------------------------
426  override void OnPostInit(IEntity owner)
427  {
428  SetEventMask(owner, EntityEvent.INIT);
429 
430  super.OnPostInit(owner);
431  }
432 
433  //------------------------------------------------------------------------------------------------
434  override void EOnInit(IEntity owner)
435  {
436  super.EOnInit(owner);
437 
438  if (System.IsConsoleApp() || !GetGame().GetPlayerController())
440  }
441 
442  //------------------------------------------------------------------------------------------------
445  void AddNewActiveUser(int userID)
446  {
447  m_aActiveUsersIDs.Insert(userID);
449  }
450 
451  //------------------------------------------------------------------------------------------------
454  void RemoveActiveUser(int userID)
455  {
456  m_aActiveUsersIDs.RemoveItem(userID);
457  }
458 
459  //------------------------------------------------------------------------------------------------
462  int GetActiveUsers(out notnull array<int> users)
463  {
464  return users.Copy(m_aActiveUsersIDs);
465  }
466 
467  //------------------------------------------------------------------------------------------------
471  bool ContainActiveUsers(int playerId)
472  {
473  return m_aActiveUsersIDs.Contains(playerId);
474  }
475 
476  //------------------------------------------------------------------------------------------------
479  void AddNewAvailableUser(int userID)
480  {
481  m_aAvailableUsersIDs.Insert(userID);
483  }
484 
485  //------------------------------------------------------------------------------------------------
488  void RemoveAvailableUser(int userID)
489  {
490  m_aAvailableUsersIDs.RemoveItem(userID);
491  }
492 
493  //------------------------------------------------------------------------------------------------
496  int GetAvailableUsers(out array<int> users)
497  {
498  return users.Copy(m_aAvailableUsersIDs);
499  }
500 
501  //------------------------------------------------------------------------------------------------
505  bool ContainAvailableUsers(int playerId)
506  {
507  return m_aAvailableUsersIDs.Contains(playerId);
508  }
509 
510  //------------------------------------------------------------------------------------------------
514  void RequestBuildingMode(int playerID, bool userActionUsed)
515  {
516  RequestEnterBuildingMode(playerID, userActionUsed);
517  }
518 
519  //------------------------------------------------------------------------------------------------
523  void RequestEnterBuildingMode(int playerID, bool userActionUsed)
524  {
525  SCR_CampaignBuildingNetworkComponent networkComponent = GetNetworkManager();
526  if (!networkComponent)
527  return;
528 
529  SCR_EditorManagerEntity editorManager = GetEditorManager();
530  if (!editorManager)
531  return;
532 
534  SetOnPlayerTeleported(playerID);
535  editorManager.GetOnOpenedServer().Insert(BuildingModeCreated);
536  editorManager.GetOnClosed().Insert(OnModeClosed);
537  networkComponent.RequestEnterBuildingMode(GetOwner(), playerID, m_bUserActionActivationOnly, userActionUsed);
538  }
539 
540  //------------------------------------------------------------------------------------------------
542  void SetOnPlayerTeleported(int playerID)
543  {
544  PlayerController playerController = GetGame().GetPlayerController();
545  if (!playerController)
546  return;
547 
548  SCR_PlayerTeleportedFeedbackComponent playerTeleportComponent = SCR_PlayerTeleportedFeedbackComponent.Cast(playerController.FindComponent(SCR_PlayerTeleportedFeedbackComponent));
549  if (!playerTeleportComponent)
550  return;
551 
552  playerTeleportComponent.GetOnPlayerTeleported().Insert(PlayerTeleported);
553  }
554 
555  //------------------------------------------------------------------------------------------------
558  {
559  ChimeraCharacter player = ChimeraCharacter.Cast(SCR_PlayerController.GetLocalControlledEntity());
560  if (!player)
561  return;
562 
563  SCR_CharacterControllerComponent controller = SCR_CharacterControllerComponent.Cast(player.GetCharacterController());
564  if (controller)
565  controller.m_OnLifeStateChanged.Insert(OnLifeStateChanged);
566  }
567 
568  //------------------------------------------------------------------------------------------------
570  void OnLifeStateChanged(ECharacterLifeState previousLifeState, ECharacterLifeState newLifeState)
571  {
572  if (newLifeState == ECharacterLifeState.ALIVE)
573  return;
574 
575  SCR_CampaignBuildingNetworkComponent networkComponent = GetNetworkManager();
576  if (!networkComponent)
577  return;
578 
579  networkComponent.RemoveEditorMode(SCR_PlayerController.GetLocalPlayerId(), GetOwner());
580  }
581 
582  //------------------------------------------------------------------------------------------------
587  void PlayerTeleported(SCR_EditableCharacterComponent character, bool isLongFade, SCR_EPlayerTeleportedReason teleportReason)
588  {
589  SCR_CampaignBuildingNetworkComponent networkComponent = GetNetworkManager();
590  if (!networkComponent)
591  return;
592 
593  networkComponent.RemoveEditorMode(SCR_PlayerController.GetLocalPlayerId(), GetOwner());
594 
595  }
596 
597  //------------------------------------------------------------------------------------------------
600  {
601  ChimeraCharacter player = ChimeraCharacter.Cast(SCR_PlayerController.GetLocalControlledEntity());
602  if (!player)
603  return;
604 
605  SCR_CharacterControllerComponent controller = SCR_CharacterControllerComponent.Cast(player.GetCharacterController());
606  if (controller)
607  controller.m_OnLifeStateChanged.Remove(OnLifeStateChanged);
608  }
609 
610  //------------------------------------------------------------------------------------------------
613  {
615  if (!factionComponent)
616  return;
617 
618  factionComponent.GetOnFactionChanged().Insert(OnBaseOwnerChanged);
619  }
620 
621  //------------------------------------------------------------------------------------------------
624  {
626  if (!comp)
627  return;
628 
629  comp.GetOnPlayerDeathWithParam().Insert(OnActiveUserDeath);
630  }
631 
632  //------------------------------------------------------------------------------------------------
635  {
637  if (!comp)
638  return;
639 
640  comp.GetOnPlayerDeathWithParam().Insert(OnAvailableUserDeath);
641  }
642 
643  //------------------------------------------------------------------------------------------------
647  void OnActiveUserDeath(SCR_CharacterControllerComponent characterControllerComponent, IEntity instigatorEntity, notnull Instigator instigator)
648  {
649  RemoveActiveUser(GetPlayerIdFromCharacterController(characterControllerComponent));
650  }
651 
652  //------------------------------------------------------------------------------------------------
656  void OnAvailableUserDeath(SCR_CharacterControllerComponent characterControllerComponent, IEntity instigatorEntity, notnull Instigator instigator)
657  {
658  RemoveAvailableUser(GetPlayerIdFromCharacterController(characterControllerComponent));
659  }
660 
661  //------------------------------------------------------------------------------------------------
664  {
665  SCR_EditorManagerEntity editorManager = GetEditorManager();
666  if (!editorManager)
667  return;
668 
669  editorManager.GetOnOpenedServer().Remove(BuildingModeCreated);
670 
671  SCR_EditorModeEntity editorMode = editorManager.GetCurrentModeEntity();
672  if (!editorMode)
673  return;
674 
675  SCR_PlacingEditorComponent placingComponent = SCR_PlacingEditorComponent.Cast(editorMode.FindComponent(SCR_PlacingEditorComponent));
676  if (!placingComponent)
677  return;
678 
679  placingComponent.GetOnPlaceEntityServer().Insert(EntitySpawnedByProvider);
680  }
681 
682  //------------------------------------------------------------------------------------------------
684  void EntitySpawnedByProvider(int prefabID, SCR_EditableEntityComponent editableEntity)
685  {
686  SCR_GameModeCampaign campaign = SCR_GameModeCampaign.GetInstance();
687  if (!campaign)
688  return;
689 
690  if (m_aActiveUsersIDs.IsEmpty())
691  return;
692 
693  IEntity player = GetGame().GetPlayerManager().GetPlayerControlledEntity(m_aActiveUsersIDs[0]);
694  campaign.OnEntityRequested(editableEntity.GetOwner(), player, SCR_Faction.Cast(GetEntityFaction(GetOwner())), this);
695  }
696 
697  //------------------------------------------------------------------------------------------------
700  {
704 
705  m_aShownBudget.Clear();
706 
707  SCR_CampaignBuildingNetworkComponent networkComponent = GetNetworkManager();
708  if (!networkComponent)
709  return;
710 
711  networkComponent.RemoveEditorMode(SCR_PlayerController.GetLocalPlayerId(), GetOwner());
712  }
713 
714  //------------------------------------------------------------------------------------------------
716  static ScriptInvokerVoid GetOnProviderCreated()
717  {
718  return s_OnProviderCreated;
719  }
720 
721  //------------------------------------------------------------------------------------------------
724  {
725  SCR_EditorManagerEntity editorManager = GetEditorManager();
726  if (!editorManager)
727  return;
728 
729  editorManager.GetOnClosed().Remove(OnModeClosed);
730  }
731 
732  //------------------------------------------------------------------------------------------------
735  {
736  PlayerController playerController = GetGame().GetPlayerController();
737  if (!playerController)
738  return;
739 
740  SCR_PlayerTeleportedFeedbackComponent playerTeleportComponent = SCR_PlayerTeleportedFeedbackComponent.Cast(playerController.FindComponent(SCR_PlayerTeleportedFeedbackComponent));
741  if (!playerTeleportComponent)
742  return;
743 
744  playerTeleportComponent.GetOnPlayerTeleported().Remove(PlayerTeleported);
745  }
746 
747  //------------------------------------------------------------------------------------------------
750  {
752  }
753 
754  //------------------------------------------------------------------------------------------------
756  protected SCR_CampaignBuildingNetworkComponent GetNetworkManager()
757  {
758  PlayerController playerController = GetGame().GetPlayerController();
759  if (!playerController)
760  return null;
761 
762  return SCR_CampaignBuildingNetworkComponent.Cast(playerController.FindComponent(SCR_CampaignBuildingNetworkComponent));
763  }
764 
765  //------------------------------------------------------------------------------------------------
768  {
770  if (!core)
771  return null;
772 
773  return core.GetEditorManager();
774  }
775 
776  //------------------------------------------------------------------------------------------------
779  {
781  if (!core)
782  return null;
783 
784  return core.GetEditorManager(playerId);
785  }
786 
787  //------------------------------------------------------------------------------------------------
789  {
790  IEntity player = GetGame().GetPlayerManager().GetPlayerControlledEntity(playerID);
791  if (!player)
792  return null;
793 
794  return SCR_CharacterControllerComponent.Cast(player.FindComponent(SCR_CharacterControllerComponent));
795  }
796 
797  //------------------------------------------------------------------------------------------------
798  protected int GetPlayerIdFromCharacterController(SCR_CharacterControllerComponent characterControllerComponent)
799  {
800  if (!characterControllerComponent)
801  return -1;
802 
803  IEntity ent = characterControllerComponent.GetOwner();
804  if (!ent)
805  return -1;
806 
807  return GetGame().GetPlayerManager().GetPlayerIdFromControlledEntity(ent);
808  }
809 
810  //------------------------------------------------------------------------------------------------
812  // Method called by a user action to make sure it can only be shown to the players of the same faction the base belongs to.
815  bool IsCharacterFactionSame(notnull IEntity character)
816  {
817  Faction playerFaction = GetEntityFaction(character);
818  if (!playerFaction)
819  return false;
820 
821  IEntity provider = GetOwner();
822  if (!provider)
823  return false;
824 
825  Faction owningFaction = GetEntityFaction(provider);
826  if (!owningFaction)
827  return false;
828 
829  return playerFaction == owningFaction;
830  }
831 
832  //------------------------------------------------------------------------------------------------
833  protected Faction GetEntityFaction(notnull IEntity ent)
834  {
835  FactionAffiliationComponent factionComp = FactionAffiliationComponent.Cast(ent.FindComponent(FactionAffiliationComponent));
836 
837  // Seacrch for the faction component on parent entities as not always is it on the same component as this one (vehicle for an example)
838  while (!factionComp && ent)
839  {
840  ent = ent.GetParent();
841  if (ent)
842  factionComp = FactionAffiliationComponent.Cast(ent.FindComponent(FactionAffiliationComponent));
843  }
844 
845  if (!factionComp)
846  return null;
847 
848  Faction faction = factionComp.GetAffiliatedFaction();
849  if (!faction)
850  faction = factionComp.GetDefaultAffiliatedFaction();
851 
852  return faction;
853  }
854 
855  //------------------------------------------------------------------------------------------------
860  protected void OnBaseOwnerChanged(FactionAffiliationComponent owner, Faction previousFaction, Faction newFaction)
861  {
862  // ToDo: In the future if the trigger activation will be enabled again, here I have to use a trigger range to find all entities which should be added and remove those on the list now.
864  }
865 
866  //------------------------------------------------------------------------------------------------
868  SCR_ResourceComponent GetResourceComponent()
869  {
870  if (!m_ResourceComponent)
871  m_ResourceComponent = SCR_ResourceComponent.FindResourceComponent(GetOwner());
872 
873  return m_ResourceComponent;
874  }
875 
876  //------------------------------------------------------------------------------------------------
878  [Obsolete("SCR_CampaignBuildingProviderComponent.GetResourceComponent() should be used instead.")]
880  {
882  }
883 
884  //------------------------------------------------------------------------------------------------
887  {
889  {
890  if (budgetData.GetBudget() == budget)
891  return budgetData;
892  }
893 
894  return null;
895  }
896 
897  //------------------------------------------------------------------------------------------------
899  int GetBudgetTypesToEvaluate(notnull out array<ref EEditableEntityBudget> budgets)
900  {
902  {
903  budgets.Insert(budgetData.GetBudget());
904  }
905 
906  return budgets.Count();
907  }
908 
909  //------------------------------------------------------------------------------------------------
913  {
915  return false;
916 
918  {
919  if (budgetData.GetBudget() == blockingBudget && budgetData.CanBeUsed())
920  return true;
921  }
922 
923  return false;
924  }
925 
926  //------------------------------------------------------------------------------------------------
929  {
931  {
932  if (budgetData.CanShowBudgetInUI() && !m_aShownBudget.Contains(budgetData))
933  {
934  m_aShownBudget.Insert(budgetData);
935  return budgetData.GetBudget();
936  }
937  }
938 
939  return -1;
940  }
941 
942  //------------------------------------------------------------------------------------------------
944  int CalculateCooldownTime(int playerId, int cooldownTime)
945  {
947 
949  {
950  if (budgetData.GetBudget() == EEditableEntityBudget.COOLDOWN)
951  {
952  cooldownBudgetData = SCR_CampaignBuildingCooldownWithRankBudgetToEvaluateData.Cast(budgetData);
953  if (!cooldownBudgetData)
954  continue;
955 
956  return cooldownBudgetData.CooldownTimeModifier(playerId, cooldownTime);
957  }
958  }
959 
960  return cooldownTime;
961  }
962 
963  //------------------------------------------------------------------------------------------------
966  {
967  BaseGameMode gameMode = GetGame().GetGameMode();
968  if (!gameMode)
969  return;
970 
971  SCR_CampaignBuildingManagerComponent buildingManagerComponent = SCR_CampaignBuildingManagerComponent.Cast(gameMode.FindComponent(SCR_CampaignBuildingManagerComponent));
972  if (!buildingManagerComponent)
973  return;
974 
975  bool isActiveUser;
976  foreach (int playerId : m_aAvailableUsersIDs)
977  {
978  isActiveUser = false;
979 
980  SCR_EditorManagerEntity editorManager = GetEditorManagerByID(playerId);
981  if (!editorManager)
982  return;
983 
984  SCR_EditorModeEntity modeEntity = SCR_EditorModeEntity.Cast(editorManager.FindModeEntity(EEditorMode.BUILDING));
985  if (!modeEntity)
986  return;
987 
988  if (m_aActiveUsersIDs.Contains(playerId))
989  {
990  RemoveActiveUser(playerId);
991  isActiveUser = true;
992  }
993 
994  buildingManagerComponent.RemoveProvider(playerId, this, isActiveUser);
995  RemoveAvailableUser(playerId);
996  }
997 
999  }
1000 
1001  //------------------------------------------------------------------------------------------------
1004  {
1005  if (IsProviderDynamic())
1006  GetGame().GetCallqueue().Remove(CheckProviderMove);
1007  }
1008 
1009  //------------------------------------------------------------------------------------------------
1012  {
1013  if (IsProviderDynamic())
1014  GetGame().GetCallqueue().CallLater(CheckProviderMove, MOVING_CHECK_PERIOD, true);
1015  }
1016 
1017  //------------------------------------------------------------------------------------------------
1019  private void CheckProviderMove()
1020  {
1021  vector velocity = m_ProviderPhysics.GetVelocity();
1022 
1023  if ((velocity.LengthSq()) > PROVIDER_SPEED_TO_REMOVE_BUILDING_SQ)
1025  }
1026 
1027  //------------------------------------------------------------------------------------------------
1029  private bool IsProviderDynamic()
1030  {
1031  IEntity mainParent = SCR_EntityHelper.GetMainParent(GetOwner(), true);
1032  if (!mainParent)
1033  return false;
1034 
1035  m_ProviderPhysics = mainParent.GetPhysics();
1036 
1037  return m_ProviderPhysics && m_ProviderPhysics.IsDynamic();
1038  }
1039 
1040  //------------------------------------------------------------------------------------------------
1043  bool IsEnemyFaction(notnull ChimeraCharacter char)
1044  {
1045  FactionAffiliationComponent factionComponent = FactionAffiliationComponent.Cast(char.FindComponent(FactionAffiliationComponent));
1046  if (!factionComponent)
1047  return false;
1048 
1049  Faction faction = factionComponent.GetAffiliatedFaction();
1050  if (!faction )
1051  return false;
1052 
1053  SCR_CampaignFactionManager factionManager = SCR_CampaignFactionManager.Cast(GetGame().GetFactionManager());
1054  if (!factionManager)
1055  return false;
1056 
1057  Faction playerFaction = factionManager.GetLocalPlayerFaction();
1058  if (!playerFaction)
1059  return false;
1060 
1061  return playerFaction.IsFactionEnemy(faction);
1062  }
1063 
1064  //------------------------------------------------------------------------------------------------
1065  override bool RplLoad(ScriptBitReader reader)
1066  {
1067  s_OnProviderCreated.Invoke();
1068  return true;
1069  }
1070 
1071  //------------------------------------------------------------------------------------------------
1072  // destructor
1074  {
1075  if (!m_aAvailableUsersIDs.IsEmpty())
1077  }
1078 }
m_aAvailableTraits
protected ref array< EEditableEntityLabel > m_aAvailableTraits
Definition: SCR_CampaignBuildingProviderComponent.c:39
SCR_EPlayerTeleportedReason
SCR_EPlayerTeleportedReason
Definition: SCR_PlayerTeleportedFeedbackComponent.c:50
ChimeraWorld
Definition: ChimeraWorld.c:12
RemoveActiveUser
void RemoveActiveUser(int userID)
Definition: SCR_CampaignBuildingProviderComponent.c:454
GetOnCooldownLockUpdated
ScriptInvokerVoid GetOnCooldownLockUpdated()
Definition: SCR_CampaignBuildingProviderComponent.c:246
EEditableEntityLabel
EEditableEntityLabel
Definition: EEditableEntityLabel.c:1
GetCurrentAIValue
int GetCurrentAIValue()
Definition: SCR_CampaignBuildingProviderComponent.c:349
m_ProviderPhysics
protected Physics m_ProviderPhysics
Definition: SCR_CampaignBuildingProviderComponent.c:49
SCR_CampaignBuildingProviderComponentClass
Definition: SCR_CampaignBuildingProviderComponent.c:2
GetEditorManagerByID
protected SCR_EditorManagerEntity GetEditorManagerByID(int playerId)
Definition: SCR_CampaignBuildingProviderComponent.c:778
ObstrucViewWhenEnemyInRange
bool ObstrucViewWhenEnemyInRange()
Definition: SCR_CampaignBuildingProviderComponent.c:98
AddNewAvailableUser
void AddNewAvailableUser(int userID)
Definition: SCR_CampaignBuildingProviderComponent.c:479
RemoveActiveUsers
void RemoveActiveUsers()
Method called when the provider was destroyed or deleted to remove a provider.
Definition: SCR_CampaignBuildingProviderComponent.c:965
SCR_PlayerController
Definition: SCR_PlayerController.c:31
SCR_EntityHelper
Definition: SCR_EntityHelper.c:1
GetAccessRank
SCR_ECharacterRank GetAccessRank()
Definition: SCR_CampaignBuildingProviderComponent.c:285
CanCommandAI
bool CanCommandAI()
Definition: SCR_CampaignBuildingProviderComponent.c:91
GetBudgetData
SCR_CampaignBuildingBudgetToEvaluateData GetBudgetData(EEditableEntityBudget budget)
Get data of given budget.
Definition: SCR_CampaignBuildingProviderComponent.c:886
GetMaxBudgetValue
int GetMaxBudgetValue(EEditableEntityBudget budget)
Return max value of the given budget if this budget is added to be evaluated with this provider and h...
Definition: SCR_CampaignBuildingProviderComponent.c:299
SetOnPlayerDeathAvailableUserEvent
void SetOnPlayerDeathAvailableUserEvent(int userID)
Definition: SCR_CampaignBuildingProviderComponent.c:634
RequestBuildingMode
void RequestBuildingMode(int playerID, bool userActionUsed)
Definition: SCR_CampaignBuildingProviderComponent.c:514
GetAvailableUsers
int GetAvailableUsers(out array< int > users)
Definition: SCR_CampaignBuildingProviderComponent.c:496
m_iCurrentPropValue
protected int m_iCurrentPropValue
Current props Value represents, how many entities with set prop budget can be spawned with this provi...
Definition: SCR_CampaignBuildingProviderComponent.c:43
EntityEditorProps
enum EQueryType EntityEditorProps(category:"GameScripted/Sound", description:"THIS IS THE SCRIPT DESCRIPTION.", color:"0 0 255 255")
Definition: SCR_AmbientSoundsComponent.c:12
m_bUserActionActivationOnly
protected bool m_bUserActionActivationOnly
Definition: SCR_CampaignBuildingProviderComponent.c:12
SetOnProviderFactionChangedEvent
void SetOnProviderFactionChangedEvent()
Insert a method called when the provider faction is changed, e.g a base is taken by an enemy.
Definition: SCR_CampaignBuildingProviderComponent.c:612
GetBudgetTypesToEvaluate
int GetBudgetTypesToEvaluate(notnull out array< ref EEditableEntityBudget > budgets)
Returns all budget types to evaluate with this provider.
Definition: SCR_CampaignBuildingProviderComponent.c:899
ECharacterLifeState
ECharacterLifeState
Definition: ECharacterLifeState.c:12
OnAvailableUserDeath
void OnAvailableUserDeath(SCR_CharacterControllerComponent characterControllerComponent, IEntity instigatorEntity, notnull Instigator instigator)
Definition: SCR_CampaignBuildingProviderComponent.c:656
GetEditorManager
protected SCR_EditorManagerEntity GetEditorManager()
Definition: SCR_CampaignBuildingProviderComponent.c:767
IsBudgetToEvaluate
bool IsBudgetToEvaluate(EEditableEntityBudget blockingBudget)
Definition: SCR_CampaignBuildingProviderComponent.c:912
AddNewActiveUser
void AddNewActiveUser(int userID)
Definition: SCR_CampaignBuildingProviderComponent.c:445
m_aAvailableUsersIDs
protected ref array< int > m_aAvailableUsersIDs
Definition: SCR_CampaignBuildingProviderComponent.c:54
OnActiveUserDeath
void OnActiveUserDeath(SCR_CharacterControllerComponent characterControllerComponent, IEntity instigatorEntity, notnull Instigator instigator)
Definition: SCR_CampaignBuildingProviderComponent.c:647
ContainAvailableUsers
bool ContainAvailableUsers(int playerId)
Definition: SCR_CampaignBuildingProviderComponent.c:505
m_bRegisterAtBase
protected bool m_bRegisterAtBase
Definition: SCR_CampaignBuildingProviderComponent.c:21
SCR_MilitaryBaseLogicComponentClass
Definition: SCR_MilitaryBaseLogicComponent.c:1
RplProp
SCR_RplTestEntityClass RplProp
Used for handling entity spawning requests for SCR_CatalogEntitySpawnerComponent and inherited classe...
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
RemoveAvailableUser
void RemoveAvailableUser(int userID)
Definition: SCR_CampaignBuildingProviderComponent.c:488
CanRegisterAtMilitaryBase
bool CanRegisterAtMilitaryBase()
Definition: SCR_CampaignBuildingProviderComponent.c:265
SetClientLock
void SetClientLock(bool lock, IEntity provider, int playerId)
Definition: SCR_CampaignBuildingProviderComponent.c:153
GetCurrentPropValue
int GetCurrentPropValue()
Definition: SCR_CampaignBuildingProviderComponent.c:314
m_aBudgetsToEvaluate
protected ref array< ref SCR_CampaignBuildingBudgetToEvaluateData > m_aBudgetsToEvaluate
Definition: SCR_CampaignBuildingProviderComponent.c:36
IsEnemyFaction
bool IsEnemyFaction(notnull ChimeraCharacter char)
Definition: SCR_CampaignBuildingProviderComponent.c:1043
SCR_ECharacterRank
SCR_ECharacterRank
Definition: SCR_CharacterRankComponent.c:305
m_OnCooldownLockUpdated
protected ref ScriptInvokerVoid m_OnCooldownLockUpdated
Definition: SCR_CampaignBuildingProviderComponent.c:58
m_iRank
protected SCR_ECharacterRank m_iRank
Definition: SCR_CampaignBuildingProviderComponent.c:33
m_bUseMasterProvider
protected bool m_bUseMasterProvider
Definition: SCR_CampaignBuildingProviderComponent.c:18
HasCooldownSet
bool HasCooldownSet(int playerId)
Is placing allowed for this player?
Definition: SCR_CampaignBuildingProviderComponent.c:218
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
GetAvailableTraits
array< EEditableEntityLabel > GetAvailableTraits()
Definition: SCR_CampaignBuildingProviderComponent.c:418
SCR_EditorModeEntity
Definition: SCR_EditorModeEntity.c:22
BuildingModeCreated
void BuildingModeCreated()
Definition: SCR_CampaignBuildingProviderComponent.c:663
~SCR_CampaignBuildingProviderComponent
void ~SCR_CampaignBuildingProviderComponent()
Definition: SCR_CampaignBuildingProviderComponent.c:1073
CheckProviderMove
private void CheckProviderMove()
Check if the provider velocity in meters per second is faster then allowed. If so,...
Definition: SCR_CampaignBuildingProviderComponent.c:1019
GetNetworkManager
protected SCR_CampaignBuildingNetworkComponent GetNetworkManager()
Definition: SCR_CampaignBuildingProviderComponent.c:756
GetEntityFaction
protected Faction GetEntityFaction(notnull IEntity ent)
Definition: SCR_CampaignBuildingProviderComponent.c:833
func
func
Definition: SCR_AIThreatSystem.c:5
SCR_CharacterControllerComponent
Definition: SCR_CharacterControllerComponent.c:35
GetPlayerController
proto external PlayerController GetPlayerController()
Definition: SCR_PlayerDeployMenuHandlerComponent.c:307
EEditableEntityBudget
EEditableEntityBudget
Definition: EEditableEntityBudget.c:1
Instigator
Definition: Instigator.c:6
m_bObstructViewWhenEnemyInRange
protected bool m_bObstructViewWhenEnemyInRange
Definition: SCR_CampaignBuildingProviderComponent.c:27
MOVING_CHECK_PERIOD
const protected int MOVING_CHECK_PERIOD
Definition: SCR_CampaignBuildingProviderComponent.c:60
SetAIValue
void SetAIValue(int value)
Definition: SCR_CampaignBuildingProviderComponent.c:360
RplLoad
override bool RplLoad(ScriptBitReader reader)
Definition: SCR_CampaignBuildingProviderComponent.c:1065
PlayerTeleported
void PlayerTeleported(SCR_EditableCharacterComponent character, bool isLongFade, SCR_EPlayerTeleportedReason teleportReason)
Definition: SCR_CampaignBuildingProviderComponent.c:587
SCR_CampaignSuppliesComponent
void SCR_CampaignSuppliesComponent(IEntityComponentSource src, IEntity ent, IEntity parent)
Definition: SCR_CampaignSuppliesComponent.c:327
SCR_GameModeCampaign
void SCR_GameModeCampaign(IEntitySource src, IEntity parent)
Definition: SCR_GameModeCampaign.c:1927
GetCharacterControllerComponent
protected SCR_CharacterControllerComponent GetCharacterControllerComponent(int playerID)
Definition: SCR_CampaignBuildingProviderComponent.c:788
SCR_CampaignBuildingMaxValueBudgetToEvaluateData
Definition: SCR_CampaignBuildingMaxValueBudgetToEvaluateData.c:3
AddPropValue
void AddPropValue(int value)
Definition: SCR_CampaignBuildingProviderComponent.c:336
SCR_CampaignBuildingBudgetToEvaluateData
Definition: SCR_CampaignBuildingBudgetToEvaluateData.c:3
m_aActiveUsersIDs
protected ref array< int > m_aActiveUsersIDs
Definition: SCR_CampaignBuildingProviderComponent.c:53
SCR_EditorManagerCore
Core component to manage SCR_EditorManagerEntity.
Definition: SCR_EditorManagerCore.c:5
EntitySpawnedByProvider
void EntitySpawnedByProvider(int prefabID, SCR_EditableEntityComponent editableEntity)
Event rised when the entity is spawned by this provider.
Definition: SCR_CampaignBuildingProviderComponent.c:684
SetCooldownClientLock
void SetCooldownClientLock(bool val)
Definition: SCR_CampaignBuildingProviderComponent.c:167
GetBuildingRadius
float GetBuildingRadius()
Definition: SCR_CampaignBuildingProviderComponent.c:292
GetBases
int GetBases(out array< SCR_MilitaryBaseComponent > bases)
Definition: SCR_MilitaryBaseLogicComponent.c:51
m_MasterProviderComponent
SCR_CampaignBuildingProviderComponent m_MasterProviderComponent
Definition: SCR_CampaignBuildingProviderComponent.c:66
RegisterBase
override void RegisterBase(notnull SCR_MilitaryBaseComponent base)
Definition: SCR_CampaignBuildingProviderComponent.c:255
OnPostInit
override void OnPostInit(IEntity owner)
Called on PostInit when all components are added.
Definition: SCR_CampaignBuildingProviderComponent.c:426
SetOnPlayerDeathActiveUserEvent
void SetOnPlayerDeathActiveUserEvent(int userID)
Definition: SCR_CampaignBuildingProviderComponent.c:623
m_bCanCommandAI
protected bool m_bCanCommandAI
Definition: SCR_CampaignBuildingProviderComponent.c:24
RemoveOnPlayerTeleported
void RemoveOnPlayerTeleported()
Definition: SCR_CampaignBuildingProviderComponent.c:734
IsMasterProvider
bool IsMasterProvider()
Master provider can be for an example HQ where there are other services that can serve as providers (...
Definition: SCR_CampaignBuildingProviderComponent.c:84
SetCheckProviderMove
void SetCheckProviderMove()
Definition: SCR_CampaignBuildingProviderComponent.c:1011
m_ResourceComponent
protected SCR_ResourceComponent m_ResourceComponent
Definition: SCR_CampaignBuildingProviderComponent.c:51
m_aShownBudget
protected ref array< SCR_CampaignBuildingBudgetToEvaluateData > m_aShownBudget
Definition: SCR_CampaignBuildingProviderComponent.c:55
SCR_CampaignBuildingCooldownWithRankBudgetToEvaluateData
Definition: SCR_CampaignBuildingCooldownWithRankBudgetToEvaluateData.c:3
GetMilitaryBaseComponent
SCR_MilitaryBaseComponent GetMilitaryBaseComponent()
Definition: SCR_CampaignBuildingProviderComponent.c:272
GetShownBudget
EEditableEntityBudget GetShownBudget()
Evaluate all set budgets with this provider and return first one that is marked as to be shown in UI.
Definition: SCR_CampaignBuildingProviderComponent.c:928
GetOwner
IEntity GetOwner()
Owner entity of the fuel tank.
Definition: SCR_FuelNode.c:128
m_aPlacingCooldown
protected ref array< ref Tuple2< int, WorldTimestamp > > m_aPlacingCooldown
Definition: SCR_CampaignBuildingProviderComponent.c:63
SetOnEntityKilled
void SetOnEntityKilled(IEntity ent)
Set an event called when entity spawned by this provider get killed.
Definition: SCR_CampaignBuildingProviderComponent.c:395
SetPlayerCooldown
void SetPlayerCooldown(int playerId, int cooldownTime)
Set the cooldown time. First calculate if there is a potential adjustment of the time,...
Definition: SCR_CampaignBuildingProviderComponent.c:177
GetMasterProviderEntity
IEntity GetMasterProviderEntity()
Returns master provider entity of this provider if any. If not, return itself.
Definition: SCR_CampaignBuildingProviderComponent.c:105
AddAIValue
void AddAIValue(int value)
Definition: SCR_CampaignBuildingProviderComponent.c:373
GetSuppliesComponent
SCR_CampaignSuppliesComponent GetSuppliesComponent()
Definition: SCR_CampaignBuildingProviderComponent.c:879
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
m_iCurrentAIValue
protected int m_iCurrentAIValue
Current AI Value represents, how many AI is currently spawned with this provider. The max number is l...
Definition: SCR_CampaignBuildingProviderComponent.c:47
m_bIsMasterProvider
protected bool m_bIsMasterProvider
Definition: SCR_CampaignBuildingProviderComponent.c:15
EOnInit
override void EOnInit(IEntity owner)
Definition: SCR_CampaignBuildingProviderComponent.c:434
EEditorMode
EEditorMode
Editor mode that defines overall functionality.
Definition: EEditorMode.c:5
Faction
Definition: Faction.c:12
ScriptInvokerVoid
ScriptInvokerBase< ScriptInvokerVoidMethod > ScriptInvokerVoid
Definition: SCR_ScriptInvokerHelper.c:9
GetUserActionInitOnly
bool GetUserActionInitOnly()
Definition: SCR_CampaignBuildingProviderComponent.c:749
RemoveEvents
protected void RemoveEvents(IEntity ent)
remove all methods invoked to entity and related to it's dead or delete.
Definition: SCR_CampaignBuildingProviderComponent.c:407
SetPropValue
void SetPropValue(int value)
Definition: SCR_CampaignBuildingProviderComponent.c:321
SetOnPlayerTeleported
void SetOnPlayerTeleported(int playerID)
Definition: SCR_CampaignBuildingProviderComponent.c:542
PROVIDER_SPEED_TO_REMOVE_BUILDING_SQ
const protected int PROVIDER_SPEED_TO_REMOVE_BUILDING_SQ
Definition: SCR_CampaignBuildingProviderComponent.c:61
OnAIRemoved
protected void OnAIRemoved(IEntity ent)
An event called when AI spawned by this provider is killed or deleted.
Definition: SCR_CampaignBuildingProviderComponent.c:387
CalculateCooldownTime
int CalculateCooldownTime(int playerId, int cooldownTime)
Checks the budget setting and calculate final cooldown time based on it.
Definition: SCR_CampaignBuildingProviderComponent.c:944
SetOnPlayerConsciousnessChanged
void SetOnPlayerConsciousnessChanged()
Set even when player consciousness changed.
Definition: SCR_CampaignBuildingProviderComponent.c:557
GetPlayerIdFromCharacterController
protected int GetPlayerIdFromCharacterController(SCR_CharacterControllerComponent characterControllerComponent)
Definition: SCR_CampaignBuildingProviderComponent.c:798
OnModeClosed
void OnModeClosed()
Definition: SCR_CampaignBuildingProviderComponent.c:699
Attribute
SCR_CampaignBuildingProviderComponentClass SCR_MilitaryBaseLogicComponentClass Attribute("", UIWidgets.EditBox, "Name of provider shown in provider interface", "")] protected string m_sProviderDisplayName
GetProviderDisplayName
string GetProviderDisplayName()
Return name of the provider.
Definition: SCR_CampaignBuildingProviderComponent.c:70
SCR_FactionAffiliationComponent
Definition: SCR_FactionAffiliationComponent.c:10
IsCharacterFactionSame
bool IsCharacterFactionSame(notnull IEntity character)
Does character faction match the provider faction.
Definition: SCR_CampaignBuildingProviderComponent.c:815
UseMasterProvider
bool UseMasterProvider()
Should this provider use a master provider?
Definition: SCR_CampaignBuildingProviderComponent.c:77
GetResourceComponent
SCR_ResourceComponent GetResourceComponent()
Caches and returns the resource component.
Definition: SCR_CampaignBuildingProviderComponent.c:868
OnBaseOwnerChanged
protected void OnBaseOwnerChanged(FactionAffiliationComponent owner, Faction previousFaction, Faction newFaction)
Definition: SCR_CampaignBuildingProviderComponent.c:860
SCR_PlacingEditorComponent
Definition: SCR_PlacingEditorComponent.c:118
RemoveOnModeClosed
void RemoveOnModeClosed()
Definition: SCR_CampaignBuildingProviderComponent.c:723
RemoveCheckProviderMove
void RemoveCheckProviderMove()
Definition: SCR_CampaignBuildingProviderComponent.c:1003
UseMasterProviderBudget
bool UseMasterProviderBudget(EEditableEntityBudget budget, out SCR_CampaignBuildingProviderComponent masterProviderComponent)
Check if for this budget should be used budget of master provider.
Definition: SCR_CampaignBuildingProviderComponent.c:129
OnLifeStateChanged
void OnLifeStateChanged(ECharacterLifeState previousLifeState, ECharacterLifeState newLifeState)
Will be called when the life state of the character changes.
Definition: SCR_CampaignBuildingProviderComponent.c:570
m_fBuildingRadius
protected float m_fBuildingRadius
Definition: SCR_CampaignBuildingProviderComponent.c:30
ContainActiveUsers
bool ContainActiveUsers(int playerId)
Definition: SCR_CampaignBuildingProviderComponent.c:471
RequestEnterBuildingMode
void RequestEnterBuildingMode(int playerID, bool userActionUsed)
Definition: SCR_CampaignBuildingProviderComponent.c:523
RemoveOnLifeStateChanged
void RemoveOnLifeStateChanged()
Definition: SCR_CampaignBuildingProviderComponent.c:599
GetActiveUsers
int GetActiveUsers(out notnull array< int > users)
Definition: SCR_CampaignBuildingProviderComponent.c:462
GetCooldownValue
float GetCooldownValue(int playerId)
Return current value of the cooldown time for a given player.
Definition: SCR_CampaignBuildingProviderComponent.c:225
SCR_Faction
Definition: SCR_Faction.c:6
IsProviderDynamic
private bool IsProviderDynamic()
Check if the provider is dynamic. If so, save his physic component for move check.
Definition: SCR_CampaignBuildingProviderComponent.c:1029
Obsolete
RespawnSystemComponentClass GameComponentClass Obsolete()] proto external GenericEntity DoSpawn(string prefab
RespawnSystemComponent should be attached to a gamemode to handle player spawning and respawning.
m_bCooldownClientLock
protected bool m_bCooldownClientLock
Definition: SCR_CampaignBuildingProviderComponent.c:64
UpdateCooldownTimer
void UpdateCooldownTimer()
Periodically called method to evaluate a current status of the cooldown.
Definition: SCR_CampaignBuildingProviderComponent.c:191
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180
SCR_EditorManagerEntity
Definition: SCR_EditorManagerEntity.c:26