1 [
EntityEditorProps(
category:
"GameScripted/ZoneRestriction", description:
"Editor restriction zone to restrict players from leaving an specific area", color:
"255 0 0 255")]
7 [
Attribute(
"6",
desc:
"Will warn the player for going the given distance from the zone center")]
8 protected float m_fWarnRadius;
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;
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;
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))]
19 protected float m_fWarnRadiusSq;
20 protected float m_fZoneRadiusSq;
21 protected float m_fZoneTeleportedRadiusSq;
27 float GetRestrictionZoneRadius()
36 float GetRestrictionZoneRadiusSq()
38 return m_fZoneRadiusSq;
45 float GetWarningZoneRadius()
54 float GetWarningZoneRadiusSq()
56 return m_fWarnRadiusSq;
63 float GetTeleportedZoneRadiusSq()
65 return m_fZoneTeleportedRadiusSq;
74 return m_iWarningType;
77 override protected void EOnInit(IEntity owner)
79 BaseGameMode gamemode =
GetGame().GetGameMode();
84 SCR_PlayersRestrictionZoneManagerComponent restrictionZoneManager = SCR_PlayersRestrictionZoneManagerComponent.Cast(gamemode.FindComponent(SCR_PlayersRestrictionZoneManagerComponent));
86 if (!restrictionZoneManager)
89 if (m_fZoneRadius <= 0)
92 if (m_fWarnRadius > m_fZoneRadius)
93 m_fWarnRadius = m_fZoneRadius;
95 m_fZoneRadiusSq = Math.Pow(m_fZoneRadius, 2);
96 m_fWarnRadiusSq = Math.Pow(m_fWarnRadius, 2);
97 m_fZoneTeleportedRadiusSq = Math.Pow(m_fZoneTeleportedRadius, 2);
99 restrictionZoneManager.AddRestrictionZone(
this);
104 if (!Replication.IsServer() ||
SCR_Global.IsEditMode(
this))
107 SetEventMask(EntityEvent.INIT);
112 if (!Replication.IsServer() ||
SCR_Global.IsEditMode(
this))
115 BaseGameMode gamemode =
GetGame().GetGameMode();
120 SCR_PlayersRestrictionZoneManagerComponent restrictionZoneManager = SCR_PlayersRestrictionZoneManagerComponent.Cast(gamemode.FindComponent(SCR_PlayersRestrictionZoneManagerComponent));
122 if (!restrictionZoneManager)
125 restrictionZoneManager.RemoveRestrictionZone(
this);