DayZ
1.24
Loading...
Searching...
No Matches
CAContinuousCraft.c
Go to the documentation of this file.
1
class
CAContinuousCraft
:
CAContinuousTime
2
{
3
override
void
Setup
(
ActionData
action_data
)
4
{
5
m_TimeElpased
= 0;
6
m_AdjustedTimeToComplete
= 1000;
//indication of arror if somting will be craft 1000 sec
7
if
(!
m_SpentUnits
)
8
m_SpentUnits
=
new
Param1<float>
(0);
9
else
10
m_SpentUnits
.param1 = 0;
11
12
WorldCraftActionData
action_data_wc
=
WorldCraftActionData
.Cast(
action_data
);
13
14
PluginRecipesManager
module_recipes_manager
;
15
Class
.
CastTo
(
module_recipes_manager
,
GetPlugin
(PluginRecipesManager));
16
if
(
module_recipes_manager
)
17
{
18
m_AdjustedTimeToComplete
=
module_recipes_manager
.GetRecipeLengthInSecs(
action_data_wc
.m_RecipeID);
19
if
(
module_recipes_manager
.GetIsInstaRecipe(
action_data_wc
.m_RecipeID) ||
module_recipes_manager
.IsEnableDebugCrafting())
20
m_AdjustedTimeToComplete
= 0;
21
float
specialty_weight
=
module_recipes_manager
.GetRecipeSpecialty(
action_data_wc
.m_RecipeID);
22
m_AdjustedTimeToComplete
=
action_data
.m_Player.GetSoftSkillsManager().AdjustCraftingTime(
m_AdjustedTimeToComplete
,
specialty_weight
);
23
24
//PrintString("ttc:" + m_AdjustedTimeToComplete.ToString());
25
}
26
}
27
28
override
int
Execute
(
ActionData
action_data
)
29
{
30
if
(!
action_data
.m_Player)
31
return
UA_ERROR
;
32
33
if
(
m_TimeElpased
<
m_AdjustedTimeToComplete
)
34
m_TimeElpased
+=
action_data
.m_Player.GetDeltaT();
35
else
36
{
37
if
(
m_SpentUnits
)
38
{
39
m_SpentUnits
.param1 =
m_TimeElpased
;
40
SetACData
(
m_SpentUnits
);
41
}
42
OnCompletePogress
(
action_data
);
43
return
UA_FINISHED
;
44
}
45
return
UA_PROCESSING
;
46
}
47
48
override
float
GetProgress
()
49
{
50
if
(
m_AdjustedTimeToComplete
> 0)
51
{
52
//float progress = m_TimeElpased/m_AdjustedTimeToComplete;
53
return
m_TimeElpased
/
m_AdjustedTimeToComplete
;
54
}
55
return
1;
56
}
57
};
GetPlugin
PluginBase GetPlugin(typename plugin_type)
Definition
PluginManager.c:300
ActionData
Definition
ActionBase.c:21
CABase::SetACData
void SetACData(Param units)
Definition
CABase.c:38
CAContinuousBase::OnCompletePogress
void OnCompletePogress(ActionData action_data)
Definition
CAContinuousBase.c:8
CAContinuousCraft
Definition
CAContinuousCraft.c:2
CAContinuousCraft::GetProgress
override float GetProgress()
Definition
CAContinuousCraft.c:48
CAContinuousCraft::Setup
override void Setup(ActionData action_data)
Definition
CAContinuousCraft.c:3
CAContinuousCraft::Execute
override int Execute(ActionData action_data)
Definition
CAContinuousCraft.c:28
CAContinuousTime
Definition
CAContinuousTime.c:2
CAContinuousTime::m_SpentUnits
ref Param1< float > m_SpentUnits
Definition
CAContinuousTime.c:7
CAContinuousTime::m_TimeElpased
float m_TimeElpased
Definition
CAContinuousTime.c:4
CAContinuousTime::m_AdjustedTimeToComplete
float m_AdjustedTimeToComplete
Definition
CAContinuousTime.c:5
Class
Super root of all classes in Enforce script.
Definition
EnScript.c:11
Param3
Definition
EntityAI.c:95
Class::CastTo
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
UA_FINISHED
const int UA_FINISHED
Definition
constants.c:436
UA_ERROR
const int UA_ERROR
Definition
constants.c:455
UA_PROCESSING
const int UA_PROCESSING
Definition
constants.c:434
scripts
4_World
Classes
UserActionsComponent
ActionComponents
CAContinuousCraft.c
Generated by
1.10.0