Arma Reforger Explorer
1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Toggle main menu visibility
Loading...
Searching...
No Matches
SCR_CheckFuelAction.c
Go to the documentation of this file.
1
class
SCR_CheckFuelAction
:
SCR_BaseAudioScriptedUserAction
2
{
3
protected
ref
SCR_RefuelAtSupportStationAction
m_RefuelActionPair
;
4
5
FuelManagerComponent
m_FuelManager
;
6
SCR_DamageManagerComponent
m_DamageComponent
;
7
8
//------------------------------------------------------------------------------------------------
9
override
void
Init
(
IEntity
pOwnerEntity,
GenericComponent
pManagerComponent)
10
{
11
super.Init(pOwnerEntity, pManagerComponent);
12
13
m_FuelManager
= FuelManagerComponent.Cast(pOwnerEntity.
FindComponent
(FuelManagerComponent));
14
m_DamageComponent
= SCR_DamageManagerComponent.GetDamageManager(pOwnerEntity);
15
16
//~ Delay init so action manager has all action initialized
17
GetGame
().GetCallqueue().CallLater(
DelayedInit
,
param1
: pOwnerEntity);
18
}
19
20
//------------------------------------------------------------------------------------------------
21
protected
void
DelayedInit
(
IEntity
owner)
22
{
23
if
(!owner)
24
return
;
25
26
ActionsManagerComponent
actionManager =
ActionsManagerComponent
.Cast(owner.
FindComponent
(
ActionsManagerComponent
));
27
if
(!actionManager)
28
return
;
29
30
array<BaseUserAction> userActions = {};
31
actionManager.GetActionsList(userActions);
32
33
foreach
(
BaseUserAction
action : userActions)
34
{
35
m_RefuelActionPair
=
SCR_RefuelAtSupportStationAction
.Cast(action);
36
if
(
m_RefuelActionPair
)
37
break
;
38
}
39
}
40
41
//------------------------------------------------------------------------------------------------
42
override
bool
CanBeShownScript
(
IEntity
user)
43
{
44
if
(!super.CanBeShownScript(user))
45
return
false
;
46
47
if
(!
m_FuelManager
)
48
return
false
;
49
50
//~ Don't show if damage manager destroyed
51
if
(
m_DamageComponent
&&
m_DamageComponent
.GetState() ==
EDamageState
.DESTROYED)
52
return
false
;
53
54
ESupportStationReasonInvalid
cannotPerformReason;
55
if
(
m_RefuelActionPair
)
56
{
57
//~ Do not show action if the normal repair action can be performed
58
if
(
m_RefuelActionPair
.CanPerform(cannotPerformReason) || cannotPerformReason ==
ESupportStationReasonInvalid
.FUEL_TANK_FULL)
59
return
false
;
60
}
61
62
//~ No damage system present
63
return
true
;
64
}
65
66
//------------------------------------------------------------------------------------------------
67
override
bool
CanBePerformedScript
(
IEntity
user)
68
{
69
return
true
;
70
}
71
72
//------------------------------------------------------------------------------------------------
73
override
void
PerformAction
(
IEntity
pOwnerEntity,
IEntity
pUserEntity)
74
{
75
//~ Execute Audio broadcast
76
super.PerformAction(pOwnerEntity, pUserEntity);
77
78
//~ Only show notification for player that used it
79
if
(SCR_PossessingManagerComponent.GetPlayerIdFromControlledEntity(pUserEntity) !=
SCR_PlayerController
.
GetLocalPlayerId
())
80
return
;
81
82
SCR_NotificationsComponent.SendLocal(
ENotification
.CHECK_FUEL, (
m_FuelManager
.GetTotalFuel() /
m_FuelManager
.GetTotalMaxFuel()) * 100);
83
}
84
};
ENotification
ENotification
Definition
ENotification.c:5
ESupportStationReasonInvalid
ESupportStationReasonInvalid
Definition
ESupportStationReasonInvalid.c:4
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
ActionsManagerComponent
Definition
ActionsManagerComponent.c:6
BaseUserAction
Definition
BaseUserAction.c:13
GenericComponent
Definition
GenericComponent.c:13
IEntity
Definition
IEntity.c:13
IEntity::FindComponent
proto external Managed FindComponent(typename typeName)
SCR_BaseAudioScriptedUserAction
A scripted action class having optional logic for playing audio as well as checking if the faction is...
Definition
SCR_BaseAudioScriptedUserAction.c:3
SCR_CheckFuelAction
Definition
SCR_CheckFuelAction.c:2
SCR_CheckFuelAction::m_RefuelActionPair
ref SCR_RefuelAtSupportStationAction m_RefuelActionPair
Definition
SCR_CheckFuelAction.c:3
SCR_CheckFuelAction::m_FuelManager
FuelManagerComponent m_FuelManager
Definition
SCR_CheckFuelAction.c:5
SCR_CheckFuelAction::CanBeShownScript
override bool CanBeShownScript(IEntity user)
Definition
SCR_CheckFuelAction.c:42
SCR_CheckFuelAction::PerformAction
override void PerformAction(IEntity pOwnerEntity, IEntity pUserEntity)
Definition
SCR_CheckFuelAction.c:73
SCR_CheckFuelAction::m_DamageComponent
SCR_DamageManagerComponent m_DamageComponent
Definition
SCR_CheckFuelAction.c:6
SCR_CheckFuelAction::CanBePerformedScript
override bool CanBePerformedScript(IEntity user)
Definition
SCR_CheckFuelAction.c:67
SCR_CheckFuelAction::DelayedInit
void DelayedInit(IEntity owner)
Definition
SCR_CheckFuelAction.c:21
SCR_CheckFuelAction::Init
override void Init(IEntity pOwnerEntity, GenericComponent pManagerComponent)
Definition
SCR_CheckFuelAction.c:9
SCR_PlayerController
Definition
SCR_PlayerController.c:31
SCR_PlayerController::GetLocalPlayerId
static int GetLocalPlayerId()
Returns either a valid ID of local player or 0.
Definition
SCR_PlayerController.c:481
SCR_RefuelAtSupportStationAction
Definition
SCR_RefuelAtSupportStationAction.c:2
EDamageState
EDamageState
Definition
EDamageState.c:13
param1
Tuple param1
scripts
Game
UserActions
SupportStations
SCR_CheckFuelAction.c
Generated by
1.17.0