Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_EditableMineComponent.c
Go to the documentation of this file.
1[ComponentEditorProps(category: "GameScripted/Editor (Editables)", description: "", icon: "WBData/ComponentEditorProps/componentEditor.png")]
5
7
9class SCR_EditableMineComponent : SCR_EditableSystemComponent
10{
11 //------------------------------------------------------------------------------------------------
12 override void OnPostInit(IEntity owner)
13 {
14 super.OnPostInit(owner);
15
16 //~ Activate Mine on server one frame later so the SCR_PressureTriggerComponent can initialize
17 if (IsServer())
18 GetGame().GetCallqueue().CallLater(ActivateMine);
19 }
20
21 //------------------------------------------------------------------------------------------------
22 //~ Make sure the mine is activated so it explodes when a vehicle drives over it
23 protected void ActivateMine()
24 {
25 if (!GetOwner())
26 return;
27
28 SCR_PressureTriggerComponent pressureTriggerComponent = SCR_PressureTriggerComponent.Cast(GetOwner().FindComponent(SCR_PressureTriggerComponent));
29 if (!pressureTriggerComponent)
30 return;
31
32 SetInstigator(GetAuthorPlayerID());
33 pressureTriggerComponent.ActivateTrigger();
34 if (pressureTriggerComponent.GetArmingTime() > 0)
35 pressureTriggerComponent.ResetTimeout();
36 }
37
38 //------------------------------------------------------------------------------------------------
39 override bool IsDestroyed()
40 {
41 //~ If this component exists it is not destroyed
42 return false;
43 }
44
45 //------------------------------------------------------------------------------------------------
46 override bool CanDestroy()
47 {
48 //~ If this component exists it can be destroyed
49 return true;
50 }
51
52 //------------------------------------------------------------------------------------------------
53 override bool Destroy(int editorPlayerID)
54 {
55 if (!IsServer())
56 return false;
57
58 SCR_PressureTriggerComponent pressureTriggerComponent = SCR_PressureTriggerComponent.Cast(GetOwner().FindComponent(SCR_PressureTriggerComponent));
59 if (pressureTriggerComponent)
60 {
61 SetInstigator(editorPlayerID);
62 pressureTriggerComponent.TriggerManuallyServer();
63 return true;
64 }
65
66 return false;
67 }
68
69 //------------------------------------------------------------------------------------------------
70 override void SetAuthor(int playerID)
71 {
72 super.SetAuthor(playerID);
73
74 SetInstigator(GetAuthorPlayerID());
75 }
76
77 //------------------------------------------------------------------------------------------------
78 void SetInstigator(int playerID)
79 {
80 SCR_PressureTriggerComponent pressureTriggerComponent = SCR_PressureTriggerComponent.Cast(GetOwner().FindComponent(SCR_PressureTriggerComponent));
81 if (pressureTriggerComponent)
82 pressureTriggerComponent.SetInstigator(Instigator.CreateInstigatorGM(playerID));
83 }
84}
ArmaReforgerScripted GetGame()
Definition game.c:1398
enum EAIGroupCombatMode ComponentEditorProps(category:"GameScripted/AI", description:"Component for utility AI system for groups")
override bool CanDestroy()
override bool Destroy(int editorPlayerID)
override bool IsDestroyed()
void ActivateMine()
void SetInstigator(int playerID)
override bool IsServer()
IEntity GetOwner()
Owner entity of the fuel tank.