Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_EditorRestrictionZoneEntity.c
Go to the documentation of this file.
1 [EntityEditorProps(category: "GameScripted/ZoneRestriction", description: "Editor restriction zone to restrict players from leaving an specific area", color: "255 0 0 255")]
2 class SCR_EditorRestrictionZoneEntityClass: GenericEntityClass
3 {
4 };
6 {
7  [Attribute("6", desc: "Will warn the player for going the given distance from the zone center")]
8  protected float m_fWarnRadius;
9 
10  [Attribute("12", desc: "Will kill the player for going the given distance from the zone center. Needs to be equal or higher then m_fWarnRadius")]
11  protected float m_fZoneRadius;
12 
13  [Attribute("18", desc: "The distance when a player is concidered teleported. The player will not die if moved out of the zone by the given distance")]
14  protected float m_fZoneTeleportedRadius;
15 
16  [Attribute("1", desc: "Which warning UIinfo needs to be shown on the screen as defined in 'SCR_RestrictionZoneWarningHUDComponent'", uiwidget: UIWidgets.SearchComboBox, enums: ParamEnumArray.FromEnum(ERestrictionZoneWarningType))]
17  protected ERestrictionZoneWarningType m_iWarningType;
18 
19  protected float m_fWarnRadiusSq;
20  protected float m_fZoneRadiusSq;
21  protected float m_fZoneTeleportedRadiusSq;
22 
27  float GetRestrictionZoneRadius()
28  {
29  return m_fZoneRadius;
30  }
31 
36  float GetRestrictionZoneRadiusSq()
37  {
38  return m_fZoneRadiusSq;
39  }
40 
45  float GetWarningZoneRadius()
46  {
47  return m_fWarnRadius;
48  }
49 
54  float GetWarningZoneRadiusSq()
55  {
56  return m_fWarnRadiusSq;
57  }
58 
63  float GetTeleportedZoneRadiusSq()
64  {
65  return m_fZoneTeleportedRadiusSq;
66  }
67 
72  ERestrictionZoneWarningType GetWarningType()
73  {
74  return m_iWarningType;
75  }
76 
77  override protected void EOnInit(IEntity owner)
78  {
79  BaseGameMode gamemode = GetGame().GetGameMode();
80 
81  if (!gamemode)
82  return;
83 
84  SCR_PlayersRestrictionZoneManagerComponent restrictionZoneManager = SCR_PlayersRestrictionZoneManagerComponent.Cast(gamemode.FindComponent(SCR_PlayersRestrictionZoneManagerComponent));
85 
86  if (!restrictionZoneManager)
87  return;
88 
89  if (m_fZoneRadius <= 0)
90  m_fZoneRadius = 10;
91 
92  if (m_fWarnRadius > m_fZoneRadius)
93  m_fWarnRadius = m_fZoneRadius;
94 
95  m_fZoneRadiusSq = Math.Pow(m_fZoneRadius, 2);
96  m_fWarnRadiusSq = Math.Pow(m_fWarnRadius, 2);
97  m_fZoneTeleportedRadiusSq = Math.Pow(m_fZoneTeleportedRadius, 2);
98 
99  restrictionZoneManager.AddRestrictionZone(this);
100  }
101 
102  void SCR_EditorRestrictionZoneEntity(IEntitySource src, IEntity parent)
103  {
104  if (!Replication.IsServer() || SCR_Global.IsEditMode(this))
105  return;
106 
107  SetEventMask(EntityEvent.INIT);
108  }
109 
111  {
112  if (!Replication.IsServer() || SCR_Global.IsEditMode(this))
113  return;
114 
115  BaseGameMode gamemode = GetGame().GetGameMode();
116 
117  if (!gamemode)
118  return;
119 
120  SCR_PlayersRestrictionZoneManagerComponent restrictionZoneManager = SCR_PlayersRestrictionZoneManagerComponent.Cast(gamemode.FindComponent(SCR_PlayersRestrictionZoneManagerComponent));
121 
122  if (!restrictionZoneManager)
123  return;
124 
125  restrictionZoneManager.RemoveRestrictionZone(this);
126  }
127 };
EntityEditorProps
enum EQueryType EntityEditorProps(category:"GameScripted/Sound", description:"THIS IS THE SCRIPT DESCRIPTION.", color:"0 0 255 255")
Definition: SCR_AmbientSoundsComponent.c:12
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
GenericEntity
SCR_GenericBoxEntityClass GenericEntity
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_EditorRestrictionZoneEntityClass
Definition: SCR_EditorRestrictionZoneEntity.c:2
SCR_Global
Definition: Functions.c:6
SCR_EditorRestrictionZoneEntity
Definition: SCR_EditorRestrictionZoneEntity.c:5
ERestrictionZoneWarningType
ERestrictionZoneWarningType
Definition: ERestrictionZoneWarningType.c:4
category
params category
Definition: SCR_VehicleDamageManagerComponent.c:180