Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_EditableExplosiveChargeComponent.c
Go to the documentation of this file.
1[ComponentEditorProps(category: "GameScripted/Editor (Editables)", description: "", icon: "WBData/ComponentEditorProps/componentEditor.png")]
3{
4 [Attribute(desc: "If charge should be armed by default when spawned by the GM.")]
5 protected bool m_bArmedByDefault;
6
7 [Attribute("120", desc: "Default fuze time that will be used when object is spawned by GM.")]
8 protected float m_fDefaultFuzeTime;
9
10 //------------------------------------------------------------------------------------------------
12 {
13 return m_bArmedByDefault;
14 }
15
16 //------------------------------------------------------------------------------------------------
18 {
19 return m_fDefaultFuzeTime;
20 }
21}
22
24class SCR_EditableExplosiveChargeComponent : SCR_EditableSystemComponent
25{
26 //------------------------------------------------------------------------------------------------
27 override void OnPostInit(IEntity owner)
28 {
29 super.OnPostInit(owner);
30
31 //Activate charge on server one frame later so the TriggerComponent can initialize
32 if (IsServer())
33 GetGame().GetCallqueue().CallLater(ActivateCharge);
34 }
36 //------------------------------------------------------------------------------------------------
38 protected void ActivateCharge()
39 {
41 if (!data)
42 return;
43
45 if (explosiveChargeComp)
46 {
47 explosiveChargeComp.SetFuzeTime(data.GetDefaultFuzeTime(), true);
48 if (data.IsArmedByDefault())
49 explosiveChargeComp.ArmWithTimedFuze(true);
50 }
51 }
52
53 //------------------------------------------------------------------------------------------------
54 override bool IsDestroyed()
55 {
56 //~ If this component exists it is not destroyed
57 return false;
58 }
59
60 //------------------------------------------------------------------------------------------------
61 override bool CanDestroy()
62 {
63 //~ If this component exists it can be destroyed
64 return true;
65 }
66
67 //------------------------------------------------------------------------------------------------
68 override bool Destroy(int editorPlayerID)
69 {
70 if (!IsServer())
71 return false;
72
73 SCR_ExplosiveTriggerComponent explosiveChargeTrigger = SCR_ExplosiveTriggerComponent.Cast(GetOwner().FindComponent(SCR_ExplosiveTriggerComponent));
74 if (explosiveChargeTrigger)
75 {
76 explosiveChargeTrigger.SetInstigator(Instigator.CreateInstigatorGM(editorPlayerID));
77 explosiveChargeTrigger.UseTrigger();
78 return true;
79 }
80
81 return false;
82 }
83}
ArmaReforgerScripted GetGame()
Definition game.c:1398
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
SCR_CharacterSoundComponentClass GetComponentData()
override bool CanDestroy()
override bool Destroy(int editorPlayerID)
void ActivateCharge()
Arms the charge with 120s fuze.
override bool IsDestroyed()
Get all prefabs that have the spawner data
override bool IsServer()
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
enum EVehicleType IEntity
void ArmWithTimedFuze(bool silent=false)
Arms the charge and starts the timer for the detonation.
void SetFuzeTime(float fuzeDelay, bool silent=false)
Change the time which will be used for timed fuze.
IEntity GetOwner()
Owner entity of the fuel tank.
SCR_FieldOfViewSettings Attribute