Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_FastTravel_CO_Component.c
Go to the documentation of this file.
1 
3 {
4  ChimeraCharacter m_player;
5  SCR_SpawnPoint m_NewPos;
6  //SCR_MapEditorComponent m_Map;
7  SCR_GadgetManagerComponent gadgetComponent;
8  //IEntity mapGadget;
9  SCR_MapGadgetComponent mapGadgetComponent;
10  ref array<SCR_SpawnPoint> a_SpawnPoints = {};
11  Faction m_Faction;
12 
13  override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
14  {
15  SCR_MapEntity.GetOnSelection().Insert(fnMapClick);
16  }
17 
18  override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
19  {
20  m_player = ChimeraCharacter.Cast(pUserEntity);
21  if (!m_player)
22  return;
23 
24  SCR_GadgetManagerComponent gadgetManager = SCR_GadgetManagerComponent.GetGadgetManager(m_player);
25  if (!gadgetManager)
26  return;
27 
28  IEntity mapGadget = gadgetManager.GetGadgetByType(EGadgetType.MAP);
29  if (!mapGadget)
30  return;
31 
32  gadgetManager.SetGadgetMode(mapGadget, EGadgetMode.IN_HAND);
33  //gadgetComponent = SCR_GadgetManagerComponent.Cast(m_player.FindComponent(SCR_GadgetManagerComponent));
34  //mapGadget = gadgetComponent.GetGadgetByType(EGadgetType.MAP);
35  //mapGadget = gadgetComponent.GetOwner();
36  //gadgetComponent.SetGadgetMode(mapGadget, EGadgetMode.IN_HAND);
37  //mapGadgetComponent = SCR_MapGadgetComponent.Cast(mapGadget.FindComponent(SCR_MapGadgetComponent));
38  //mapGadgetComponent.SetMapMode(true);
39 
40  /*SCR_MapEditorComponent mapEditorComponent = SCR_MapEditorComponent.Cast(SCR_MapEditorComponent.GetInstance(SCR_MapEditorComponent));
41  if (mapEditorComponent)
42  {
43  mapEditorComponent.ToggleMap();
44  }*/
45  SCR_FastTravelComponent.ToggleMapDestinationSelection(true);
46  /*if (a_SpawnPoints.Count() < 2)
47  {
48  SCR_PopUpNotification.GetInstance().PopupMsg("NO HIDEOUT DISCOVERED FOR FAST TRAVEL",5,"",1);
49  } else {
50  SCR_PopUpNotification.GetInstance().PopupMsg("RANDOM HIDEOUT WAS SELECTED (CONCEPT)",5,"",1);
51  }*/
52 
53 
54  m_NewPos = a_SpawnPoints.GetRandomElement();
55  vector positionOfSpawn = m_NewPos.GetOrigin();
56  //m_player.SetOrigin(positionOfSpawn);
57 
58  /*int spawndistance = vector.Distance(m_player.GetOrigin(),positionOfSpawn);
59  if (spawndistance < 200)
60  {
61  a_SpawnPoints.RemoveItem(m_NewPos);
62  m_NewPos = a_SpawnPoints.GetRandomElement();
63  positionOfSpawn = m_NewPos.GetOrigin();
64  }
65  m_player.SetOrigin(positionOfSpawn);*/
66  }
67 
68  void fnMapClick(vector neco)
69  {
70  // close map
71  //mapGadgetComponent.SetMapMode(false);
72  //SCR_GadgetManagerComponent.GetGadgetManager(m_player).RemoveHeldGadget();
73  }
74 
75  override bool CanBePerformedScript(IEntity user)
76  {
77  a_SpawnPoints = SCR_SpawnPoint.GetSpawnPointsForFaction(m_Faction.GetFactionKey());
78  return (a_SpawnPoints.Count() > 1);
79  }
80 
81  /*override bool GetActionNameScript(out string outName)
82  {
83  outName = "HIDEOUTS";
84  a_SpawnPoints = SCR_SpawnPoint.GetSpawnPointsForFaction(m_Faction.GetFactionKey());
85  return (a_SpawnPoints.Count() < 1);
86  }*/
87 
88  override bool CanBeShownScript(IEntity user)
89  {
90  SCR_FactionManager factionManager = SCR_FactionManager.Cast(GetGame().GetFactionManager());
91  if (!factionManager && m_Faction)
92  return false;
93  m_Faction = Faction.Cast(factionManager.GetLocalPlayerFaction());
94  return true;
95  }
96 }
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
SCR_GadgetManagerComponent
Definition: SCR_GadgetManagerComponent.c:138
ScriptedUserAction
Definition: ScriptedUserAction.c:12
SCR_SpawnPoint
Spawn point entity defines positions on which players can possibly spawn.
Definition: SCR_SpawnPoint.c:27
SCR_FastTravel_CO_Component
Definition: SCR_FastTravel_CO_Component.c:2
SCR_MapEntity
Map entity.
Definition: SCR_MapEntity.c:20
Faction
Definition: Faction.c:12
SCR_FactionManager
void SCR_FactionManager(IEntitySource src, IEntity parent)
Definition: SCR_FactionManager.c:461
m_Faction
Faction m_Faction
Definition: SCR_AITargetInfo.c:18