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_UnloadSuppliesWaypoint.c
Go to the documentation of this file.
1
class
SCR_UnloadSuppliesWaypointClass
:
SCR_SuppliesTransferWaypointClass
2
{
3
}
4
5
class
SCR_UnloadSuppliesWaypoint :
SCR_SuppliesTransferWaypoint
6
{
7
//------------------------------------------------------------------------------------------------
8
override
SCR_AIWaypointState
CreateWaypointState
(
SCR_AIGroupUtilityComponent
groupUtilityComp)
9
{
10
return
new
SCR_UnloadSuppliesWaypointState
(groupUtilityComp,
this
);
11
}
12
}
13
14
class
SCR_UnloadSuppliesWaypointState : SCR_SuppliesTransferWaypointState
15
{
16
//------------------------------------------------------------------------------------------------
17
void
SCR_UnloadSuppliesWaypointState(notnull
SCR_AIGroupUtilityComponent
utility,
SCR_AIWaypoint
waypoint)
18
{
19
SCR_UnloadSuppliesWaypoint wp = SCR_UnloadSuppliesWaypoint.Cast(waypoint);
20
if
(!wp)
21
return
;
22
23
InitSupplyTransfer
(utility, wp,
EResourceGeneratorID
.DEFAULT,
EResourceGeneratorID
.VEHICLE_UNLOAD,
false
);
24
}
25
26
//------------------------------------------------------------------------------------------------
27
protected
void
Unload
()
28
{
29
SCR_BaseGameMode
gamemode =
SCR_BaseGameMode
.Cast(
GetGame
().
GetGameMode
());
30
if
(!gamemode || !gamemode.
IsMaster
())
31
return
;
32
33
SCR_UnloadSuppliesWaypoint wp = SCR_UnloadSuppliesWaypoint.Cast(
m_Waypoint
);
34
if
(!wp)
35
return
;
36
37
if
(!
m_ResourceComponent
|| !
m_ResourceGenerator
|| !
m_ResourceConsumer
)
38
{
39
Print
(
"Missing resource generator, consumer or component!"
,
LogLevel
.WARNING);
40
if
(
m_Utility
&&
m_Utility
.m_Owner)
41
m_Utility
.OnMoveFailed(
EMoveError
.UNKNOWN,
GetVehicleFromGroupLeader
(
m_Utility
),
true
,
m_Utility
.m_Owner.GetOrigin());
42
43
return
;
44
}
45
46
SCR_ResourceContainer
container =
m_ResourceComponent
.GetContainer(
RESOURCE_TYPE
);
47
float
maxResourceValue = container.
GetMaxResourceValue
();
48
49
SCR_ResourceGenerationResponse
response =
m_ResourceGenerator
.RequestAvailability(maxResourceValue);
50
51
GetResourceValues
(
m_fCurrentResource
,
m_fMaxStoredResource
,
m_fCurrentTransferValue
);
52
53
m_ResourceConsumer
.RequestConsumtion(
m_fCurrentTransferValue
);
54
m_ResourceGenerator
.RequestGeneration(
m_fCurrentTransferValue
);
55
56
SCR_ResourceComponent baseResourceComponent =
m_Base
.GetResourceComponent();
57
if
(baseResourceComponent && s_OnAITransferedSupplies)
58
s_OnAITransferedSupplies.Invoke(
EResourcePlayerInteractionType
.VEHICLE_UNLOAD, baseResourceComponent,
m_ResourceComponent
,
RESOURCE_TYPE
,
m_fCurrentTransferValue
,
m_Utility
);
59
60
bool
isStorageFull = (
m_ResourceGenerator
.GetAggregatedMaxResourceValue() -
m_ResourceGenerator
.GetAggregatedResourceValue()) <= 0;
61
if
(isStorageFull || container.
GetResourceValue
() == 0)
62
{
63
if
(
m_Utility
&&
m_Utility
.m_Owner)
64
m_Utility
.m_Owner.CompleteWaypoint(
m_Waypoint
);
65
66
}
67
else
68
{
69
// Schedule the next supply unload after a delay, unless the container is full or the truck empty
70
GetGame
().GetCallqueue().CallLater(
Unload
, wp.GetTransferDelay() * 1000,
false
);
71
}
72
}
73
74
//------------------------------------------------------------------------------------------------
75
override
void
OnSelected
()
76
{
77
super.OnSelected();
78
79
Unload
();
80
}
81
}
GetGame
ArmaReforgerScripted GetGame()
Definition
game.c:1398
m_Utility
enum SCR_EAIActivityCause m_Utility
m_Waypoint
AIWaypoint m_Waypoint
Definition
SCR_AmbientPatrolSpawnPointComponent.c:48
GetGameMode
SCR_BaseGameMode GetGameMode()
Definition
SCR_BaseGameModeComponent.c:15
EResourceGeneratorID
EResourceGeneratorID
Definition
SCR_ResourceGenerator.c:2
EResourcePlayerInteractionType
EResourcePlayerInteractionType
Definition
SCR_ResourcePlayerControllerInventoryComponent.c:2
m_ResourceComponent
SCR_ResourceComponent m_ResourceComponent
Definition
SCR_SuppliesTransferWaypoint.c:55
GetVehicleFromGroupLeader
IEntity GetVehicleFromGroupLeader(notnull SCR_AIGroupUtilityComponent utility)
Definition
SCR_SuppliesTransferWaypoint.c:140
m_fCurrentResource
float m_fCurrentResource
Definition
SCR_SuppliesTransferWaypoint.c:60
RESOURCE_TYPE
SCR_SuppliesTransferWaypoint RESOURCE_TYPE
m_Base
SCR_CampaignMilitaryBaseComponent m_Base
Definition
SCR_SuppliesTransferWaypoint.c:64
m_fCurrentTransferValue
float m_fCurrentTransferValue
Definition
SCR_SuppliesTransferWaypoint.c:61
m_fMaxStoredResource
float m_fMaxStoredResource
Definition
SCR_SuppliesTransferWaypoint.c:59
m_ResourceConsumer
SCR_ResourceConsumer m_ResourceConsumer
Definition
SCR_SuppliesTransferWaypoint.c:57
m_ResourceGenerator
SCR_ResourceGenerator m_ResourceGenerator
Definition
SCR_SuppliesTransferWaypoint.c:56
InitSupplyTransfer
void InitSupplyTransfer(notnull SCR_AIGroupUtilityComponent utility, SCR_SuppliesTransferWaypoint wp, EResourceGeneratorID generatorId, EResourceGeneratorID consumerId, bool isLoad)
Definition
SCR_SuppliesTransferWaypoint.c:69
GetResourceValues
void GetResourceValues(out float currentResource, out float maxResource, out float transferAmount)
Definition
SCR_SuppliesTransferWaypoint.c:163
SCR_AIGroupUtilityComponent
Definition
SCR_AIGroupUtilityComponent.c:18
SCR_AIWaypoint
Definition
SCR_AIWaypoint.c:6
SCR_AIWaypoint::CreateWaypointState
SCR_AIWaypointState CreateWaypointState(SCR_AIGroupUtilityComponent groupUtilityComp)
Definition
SCR_AIWaypoint.c:58
SCR_AIWaypointState
Definition
SCR_AIWaypointState.c:7
SCR_BaseGameMode
Definition
SCR_BaseGameMode.c:139
SCR_BaseGameMode::IsMaster
sealed bool IsMaster()
Definition
SCR_BaseGameMode.c:367
SCR_ResourceContainer
Definition
SCR_ResourceContainer.c:35
SCR_ResourceContainer::GetResourceValue
float GetResourceValue()
Definition
SCR_ResourceContainer.c:95
SCR_ResourceContainer::GetMaxResourceValue
float GetMaxResourceValue()
Definition
SCR_ResourceContainer.c:101
SCR_ResourceGenerationResponse
Definition
SCR_ResourceGenerator.c:14
SCR_SuppliesTransferWaypointClass
Definition
SCR_SuppliesTransferWaypoint.c:2
SCR_SuppliesTransferWaypoint
Definition
SCR_SuppliesTransferWaypoint.c:12
SCR_UnloadSuppliesWaypointClass
Definition
SCR_UnloadSuppliesWaypoint.c:2
SCR_UnloadSuppliesWaypointState
Definition
SCR_UnloadSuppliesWaypoint.c:15
SCR_UnloadSuppliesWaypointState::Unload
void Unload()
Definition
SCR_UnloadSuppliesWaypoint.c:27
SCR_UnloadSuppliesWaypointState::OnSelected
override void OnSelected()
Definition
SCR_UnloadSuppliesWaypoint.c:75
EMoveError
EMoveError
Definition
EMoveError.c:13
Print
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
LogLevel
Enum with severity of the logging message.
Definition
LogLevel.c:14
scripts
Game
AI
Group
SCR_UnloadSuppliesWaypoint.c
Generated by
1.17.0