Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_PlaceEntityContextAction.c
Go to the documentation of this file.
3 {
4  [Attribute(uiwidget: UIWidgets.ComboBox, desc: "Placing flags enabled upon creating an entity.", enums: ParamEnumArray.FromEnum(EEditorPlacingFlags))]
5  protected EEditorPlacingFlags m_PlacingFlag;
6 
7  [Attribute(desc: "Active labels and white listed labels and label groups")]
8  protected ref SCR_EditorContentBrowserDisplayConfig m_ContentBrowserConfig;
9 
10  override bool CanBeShown(SCR_EditableEntityComponent hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities, vector cursorWorldPosition, int flags)
11  {
12  if (hoveredEntity || cursorWorldPosition == vector.Zero)
13  return false;
14 
15  //--- Player unit is dead or does not exist
16  if (m_PlacingFlag == EEditorPlacingFlags.CHARACTER_PLAYER)
17  {
18  IEntity controlledEntity = SCR_PlayerController.GetLocalControlledEntity();
19  if (!controlledEntity)
20  return true;
21 
22  DamageManagerComponent damageManager = DamageManagerComponent.Cast(controlledEntity.FindComponent(DamageManagerComponent));
23  if (!damageManager)
24  return false;
25 
26  return damageManager.GetState() == EDamageState.DESTROYED;
27  }
28  return true;
29  }
30 
31  override bool CanBePerformed(SCR_EditableEntityComponent hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities, vector cursorWorldPosition, int flags)
32  {
33  return CanBeShown(hoveredEntity, selectedEntities, cursorWorldPosition, flags);
34  }
35 
36  override void Perform(SCR_EditableEntityComponent hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities, vector cursorWorldPosition,int flags, int param = -1)
37  {
38  if (DidCursorMoveDuringDoubleClick())
39  return;
40 
42  if (!placingManager || placingManager.IsPlacing() || GetGame().GetMenuManager().IsAnyDialogOpen())
43  return;
44 
45  vector transform[4];
46  transform[3] = cursorWorldPosition;
47 
48  SCR_ManualCamera camera = SCR_CameraEditorComponent.GetCameraInstance();
49  if (camera)
50  Math3D.AnglesToMatrix(Vector(camera.GetAngles()[0], 0, 0), transform);
51  else
52  Math3D.MatrixIdentity3(transform);
53 
54  placingManager.SetPlacingFlag(m_PlacingFlag, true);
55 
56  if (SCR_ContentBrowserEditorComponent.OpenBrowserLabelConfigInstance(m_ContentBrowserConfig))
57  {
58  placingManager.SetInstantPlacing(SCR_EditorPreviewParams.CreateParams(transform));
59  }
60  else
61  {
62  placingManager.SetPlacingFlag(m_PlacingFlag, false);
63  }
64  }
65  override bool IsServer()
66  {
67  return false;
68  }
69 };
SCR_ManualCamera
Definition: SCR_ManualCamera.c:16
SCR_PlayerController
Definition: SCR_PlayerController.c:31
SCR_EditorContentBrowserDisplayConfig
Definition: SCR_EditorContentBrowserDisplayConfig.c:5
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_CameraEditorComponent
Definition: SCR_CameraEditorComponent.c:13
EDamageState
EDamageState
Definition: EDamageState.c:12
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
SCR_ContentBrowserEditorComponent
Definition: SCR_ContentBrowserEditorComponent.c:16
Attribute
typedef Attribute
Post-process effect of scripted camera.
EEditorPlacingFlags
EEditorPlacingFlags
Definition: EEditorPlacingFlags.c:1
SCR_EditableEntityComponent
Definition: SCR_EditableEntityComponent.c:13
SCR_BaseContainerCustomTitleUIInfo
void SCR_BaseContainerCustomTitleUIInfo(string propertyName, string format="%1")
Definition: Attributes.c:788
DamageManagerComponent
Definition: DamageManagerComponent.c:12
SCR_PlacingEditorComponent
Definition: SCR_PlacingEditorComponent.c:118
SCR_DoubleClickAction
Definition: SCR_DoubleClickAction.c:1
SCR_EditorPreviewParams
Network packet of variables for entity placing and transformation.
Definition: SCR_EditorPreviewParams.c:4
SCR_PlaceEntityContextAction
Definition: SCR_PlaceEntityContextAction.c:2
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