Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
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();
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 manager.SetAttributeAsSubAttribute(SCR_LoadoutSupplyCostMultiplierEditorAttribute);
30 }
31
32 manager.SetAttributeEnabled(SCR_RespawnTimeEditorAttribute, var && var.GetBool());
33 manager.SetAttributeEnabled(SCR_SpawnAtPlayersEditorAttribute, var && var.GetBool());
34 manager.SetAttributeEnabled(SCR_SpawnAtRadioVehicleAttribute, var && var.GetBool());
35
37 manager.GetAttributeVariable(SCR_EnableGlobalResourceTypeEditorAttribute, globalVar);
38 bool suppliesEnabled = true;
39
40 if (globalVar)
41 suppliesEnabled = globalVar.GetBool();
42
43 manager.SetAttributeEnabled(SCR_LoadoutSupplyCostMultiplierEditorAttribute, var && var.GetBool() && suppliesEnabled);
44 }
45
46 override void WriteVariable(Managed item, SCR_BaseEditorAttributeVar var, SCR_AttributesManagerEditorComponent manager, int playerID)
47 {
48 if (!var)
49 return;
50 SCR_RespawnSystemComponent respawnSystem = SCR_RespawnSystemComponent.GetInstance();
51 if (!respawnSystem)
52 return;
53
54 bool value = var.GetBool();
55
56 //Notification
57 if (item)
58 {
59 if (value != respawnSystem.IsRespawnEnabled())
60 {
61 if (value == true)
62 {
63 SCR_NotificationsComponent.SendToEveryone(ENotification.EDITOR_ATTRIBUTES_RESPAWN_ENABLED, playerID);
64 }
65 else {
66 SCR_NotificationsComponent.SendToEveryone(ENotification.EDITOR_ATTRIBUTES_RESPAWN_DISABLED, playerID);
67 }
68 }
69 }
70
71 respawnSystem.ServerSetEnableRespawn(value);
72 }
73};
ENotification
SCR_AIAnimation_Loitering BaseContainerProps
Commanding menu commanding element class.
Base Attribute Script for other attributes to inherent from to get and set varriables in Editor Attri...
static SCR_BaseEditorAttributeVar CreateBool(bool value)