DayZ Scripts
v1.21.156300 ยท Jun 20, 2023
 
Loading...
Searching...
No Matches
CAContinuousCraft.c
Go to the documentation of this file.
2{
3 override void Setup( ActionData action_data )
4 {
6 m_AdjustedTimeToComplete = 1000; //indication of arror if somting will be craft 1000 sec
7 if ( !m_SpentUnits )
8 {
9 m_SpentUnits = new Param1<float>(0);
10 }
11 else
12 {
13 m_SpentUnits.param1 = 0;
14 }
15
16 WorldCraftActionData action_data_wc = WorldCraftActionData.Cast(action_data);
17
18 PluginRecipesManager module_recipes_manager;
19 Class.CastTo(module_recipes_manager, GetPlugin(PluginRecipesManager));
20 if( module_recipes_manager )
21 {
22 m_AdjustedTimeToComplete = module_recipes_manager.GetRecipeLengthInSecs( action_data_wc.m_RecipeID );
23 if( module_recipes_manager.GetIsInstaRecipe( action_data_wc.m_RecipeID) || module_recipes_manager.IsEnableDebugCrafting() )
24 {
26 }
27 float specialty_weight = module_recipes_manager.GetRecipeSpecialty( action_data_wc.m_RecipeID );
28 m_AdjustedTimeToComplete = action_data.m_Player.GetSoftSkillsManager().AdjustCraftingTime( m_AdjustedTimeToComplete, specialty_weight );
29
30 //PrintString("ttc:" + m_AdjustedTimeToComplete.ToString());
31 }
32 }
33
34 override int Execute( ActionData action_data )
35 {
36 if ( !action_data.m_Player )
37 {
38 return UA_ERROR;
39 }
40
42 {
43 m_TimeElpased += action_data.m_Player.GetDeltaT();
44 }
45 else
46 {
47 if ( m_SpentUnits )
48 {
51 }
52 OnCompletePogress(action_data);
53 return UA_FINISHED;
54 }
55 return UA_PROCESSING;
56 }
57
58 override float GetProgress()
59 {
61 {
62 //float progress = m_TimeElpased/m_AdjustedTimeToComplete;
64 }
65 return 1;
66 }
67};
PluginBase GetPlugin(typename plugin_type)
PlayerBase m_Player
Definition ActionBase.c:33
void SetACData(Param units)
Definition CABase.c:40
void OnCompletePogress(ActionData action_data)
override int Execute(ActionData action_data)
override float GetProgress()
override void Setup(ActionData action_data)
protected float m_AdjustedTimeToComplete
protected ref Param1< float > m_SpentUnits
protected float m_TimeElpased
Super root of all classes in Enforce script.
Definition EnScript.c:11
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const int UA_FINISHED
Definition constants.c:420
const int UA_ERROR
Definition constants.c:439
const int UA_PROCESSING
Definition constants.c:418