Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_TeleportPlayerHereContextAction.c
Go to the documentation of this file.
3 {
4  override bool CanBeShown(SCR_EditableEntityComponent hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities, vector cursorWorldPosition, int flags)
5  {
6  if (cursorWorldPosition == vector.Zero || SCR_Enum.HasFlag(flags, EEditorContextActionFlags.LIMITED))
7  return false;
8 
9  IEntity controlledEntity = SCR_PlayerController.GetLocalControlledEntity();
10  if (!controlledEntity)
11  return false;
12 
13  // Check faction entity
14  if (SCR_EditableFactionComponent.Cast(hoveredEntity))
15  return false;
16 
17  DamageManagerComponent damageManager = DamageManagerComponent.Cast(controlledEntity.FindComponent(DamageManagerComponent));
18  if (!damageManager)
19  return true;
20 
21  return damageManager.GetState() != EDamageState.DESTROYED;
22  }
23  override bool CanBePerformed(SCR_EditableEntityComponent hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities, vector cursorWorldPosition, int flags)
24  {
25  //~ Do not teleport if hovering over own player as this will cotnrol the player and teleporting player to the same location as it is doesn't really do anything
26  if (hoveredEntity && hoveredEntity.GetPlayerID() == SCR_PlayerController.GetLocalPlayerId())
27  return false;
28 
29  return CanBeShown(hoveredEntity, selectedEntities, cursorWorldPosition, flags);
30  }
31 
32  override void Perform(SCR_EditableEntityComponent hoveredEntity, notnull set<SCR_EditableEntityComponent> selectedEntities, vector cursorWorldPosition,int flags, int param = -1)
33  {
35  playersManager.TeleportPlayerToPosition(cursorWorldPosition);
36  }
37 };
SCR_PlayerController
Definition: SCR_PlayerController.c:31
SCR_Enum
Definition: SCR_Enum.c:1
SCR_PlayersManagerEditorComponent
Definition: SCR_PlayersManagerEditorComponent.c:9
EDamageState
EDamageState
Definition: EDamageState.c:12
SCR_BaseContextAction
Definition: SCR_BaseContextAction.c:7
EEditorContextActionFlags
EEditorContextActionFlags
Definition: EEditorContextActionFlags.c:1
SCR_TeleportPlayerHereContextAction
Definition: SCR_TeleportPlayerHereContextAction.c:2
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
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