Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_RespawnEnabledEditorAttribute.c
Go to the documentation of this file.
1 
4 // Script File
7 {
8  override SCR_BaseEditorAttributeVar ReadVariable(Managed item, SCR_AttributesManagerEditorComponent manager)
9  {
10  //If opened in global attributes
11  if (!IsGameMode(item)) return null;
12 
13  SCR_RespawnSystemComponent respawnSystem = SCR_RespawnSystemComponent.GetInstance();
14  if (!respawnSystem) return null;
15 
16  bool value = respawnSystem.IsRespawnEnabled();
17  return SCR_BaseEditorAttributeVar.CreateBool(value);
18  }
19 
20  //Disable respawn time if respawning is disabled
21  override void UpdateInterlinkedVariables(SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, bool isInit = false)
22  {
23  //Set sub labels
24  if (isInit)
25  {
26  manager.SetAttributeAsSubAttribute(SCR_RespawnTimeEditorAttribute);
27  manager.SetAttributeAsSubAttribute(SCR_SpawnAtPlayersEditorAttribute);
28  manager.SetAttributeAsSubAttribute(SCR_SpawnAtRadioVehicleAttribute);
29  }
30 
31  manager.SetAttributeEnabled(SCR_RespawnTimeEditorAttribute, var && var.GetBool());
32  manager.SetAttributeEnabled(SCR_SpawnAtPlayersEditorAttribute, var && var.GetBool());
33  manager.SetAttributeEnabled(SCR_SpawnAtRadioVehicleAttribute, var && var.GetBool());
34  }
35 
36  override void WriteVariable(Managed item, SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, int playerID)
37  {
38  if (!var)
39  return;
40  SCR_RespawnSystemComponent respawnSystem = SCR_RespawnSystemComponent.GetInstance();
41  if (!respawnSystem)
42  return;
43 
44  bool value = var.GetBool();
45 
46  //Notification
47  if (item)
48  {
49  if (value != respawnSystem.IsRespawnEnabled())
50  {
51  if (value == true)
52  {
53  SCR_NotificationsComponent.SendToEveryone(ENotification.EDITOR_ATTRIBUTES_RESPAWN_ENABLED, playerID);
54  }
55  else {
56  SCR_NotificationsComponent.SendToEveryone(ENotification.EDITOR_ATTRIBUTES_RESPAWN_DISABLED, playerID);
57  }
58  }
59  }
60 
61  respawnSystem.ServerSetEnableRespawn(value);
62  }
63 };
SCR_RespawnTimeEditorAttribute
Definition: SCR_RespawnTimeEditorAttribute.c:6
SCR_BaseEditorAttributeCustomTitle
Definition: SCR_BaseEditorAttribute.c:868
ENotification
ENotification
Definition: ENotification.c:4
SCR_SpawnAtPlayersEditorAttribute
Definition: SCR_SpawnAtPlayersAttribute.c:6
SCR_BaseEditorAttributeVar
Definition: SCR_BaseEditorAttributeVar.c:1
SCR_BaseEditorAttribute
Base Attribute Script for other attributes to inherent from to get and set varriables in Editor Attri...
Definition: SCR_BaseEditorAttribute.c:3
SCR_SpawnAtRadioVehicleAttribute
Definition: SCR_SpawnAtRadioVehicleAttribute.c:2
SCR_RespawnEnabledEditorAttribute
Definition: SCR_RespawnEnabledEditorAttribute.c:6
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