Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_CampaignBuildingDeleteSelectedContextAction.c
Go to the documentation of this file.
1 //------------------------------------------------------------------------------------------------
4 {
5  //------------------------------------------------------------------------------------------------
6  override int GetParam()
7  {
8  return GetGame().GetPlayerController().GetPlayerId();
9  }
10 
11  //------------------------------------------------------------------------------------------------
12  override bool CanBeShown(SCR_EditableEntityComponent selectedEntity, vector cursorWorldPosition, int flags)
13  {
14  if (!selectedEntity)
15  return false;
16 
17  SCR_CampaignBuildingCompositionComponent compositionComponent = SCR_CampaignBuildingCompositionComponent.Cast(selectedEntity.GetOwner().FindComponent(SCR_CampaignBuildingCompositionComponent));
18  if (!compositionComponent || compositionComponent.IsInteractionLocked())
19  return false;
20 
21  return super.CanBeShown(selectedEntity, cursorWorldPosition, flags);
22  }
23 
24  //------------------------------------------------------------------------------------------------
25  override bool CanBePerformed(SCR_EditableEntityComponent selectedEntity, vector cursorWorldPosition, int flags)
26  {
27  if (!selectedEntity || !CanBeDeleted(selectedEntity))
28  return false;
29 
30  return super.CanBePerformed(selectedEntity, cursorWorldPosition, flags);
31  }
32 
33  //------------------------------------------------------------------------------------------------
34  override void Perform(SCR_EditableEntityComponent hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities, vector cursorWorldPosition, int flags, int param = -1)
35  {
36  if (!hoveredEntity || !CanBeDeleted(hoveredEntity))
37  return;
38 
39  super.Perform(hoveredEntity, cursorWorldPosition);
40  }
41 
42  //------------------------------------------------------------------------------------------------
43  protected bool CanBeDeleted(notnull SCR_EditableEntityComponent hoveredEntity)
44  {
45  SCR_CampaignBuildingCompositionComponent compositionComponent = SCR_CampaignBuildingCompositionComponent.Cast(hoveredEntity.GetOwner().FindComponent(SCR_CampaignBuildingCompositionComponent));
46  if (!compositionComponent)
47  return false;
48 
49  if (compositionComponent.IsInteractionLocked())
50  {
51  SendNotification();
52  return false;
53  }
54 
55  return true;
56  }
57 
58  //------------------------------------------------------------------------------------------------
59  protected void SendNotification()
60  {
61  SCR_NotificationsComponent.SendLocal(ENotification.EDITOR_COMPOSITION_UNDER_CONSTRUCTION);
62  }
63 }
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
ENotification
ENotification
Definition: ENotification.c:4
SCR_CampaignBuildingDeleteSelectedContextAction
Definition: SCR_CampaignBuildingDeleteSelectedContextAction.c:3
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
SCR_BaseContainerCustomTitleUIInfo
void SCR_BaseContainerCustomTitleUIInfo(string propertyName, string format="%1")
Definition: Attributes.c:788
SCR_DeleteSelectedContextAction
Definition: SCR_DeleteSelectedContextAction.c:3
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468