DayZ 1.24
Loading...
Searching...
No Matches
CAContinuousTimeCooking.c
Go to the documentation of this file.
2{
3 const float TIME_DAMAGE_THRESHOLD = 5.0;
4
5 protected float m_LocalTimeElpased;
6 protected float m_TimeElapsed;
7 protected float m_TimeElapsedRepeat;
8 protected float m_TimeElapsedDamage;
10
11 protected float m_TimeToCook;
12 protected float m_AdjustedTimeToCook;
15 protected float m_CookingUpdateTime;
17
22
24 {
27
28 if (!m_SpentUnits)
30 else
31 m_SpentUnits.param1 = 0;
32
33 //fireplace & cooking process
34 FireplaceBase fireplace = FireplaceBase.Cast(action_data.m_Target.GetObject());
35 m_CookingProcess = fireplace.GetCookingProcess();
36 m_ItemToCook = m_CookingProcess.GetFoodOnStick(action_data.m_MainItem);
38
39 //update elapsed time
40 m_TimeElapsed = m_ItemToCook.GetFoodStage().GetCookingTime();
41
42 //SoftSkill implementation to hasten Cooking
43 m_AdjustedCookingUpdateTime = action_data.m_Player.GetSoftSkillsManager().SubtractSpecialtyBonus(m_CookingUpdateTime, m_Action.GetSpecialtyWeight(), true);
44 m_AdjustedTimeToCook = action_data.m_Player.GetSoftSkillsManager().SubtractSpecialtyBonus(m_TimeToCook, m_Action.GetSpecialtyWeight(), true);
45 }
46
48 {
49 if (!action_data.m_Player)
50 return UA_ERROR;
51
53 float cooking_time = m_ItemToCook.GetFoodStage().GetCookingTime();
55 {
56 m_TimeElapsed += action_data.m_Player.GetDeltaT();
57 m_TimeElapsedRepeat += action_data.m_Player.GetDeltaT();
58
60 {
62
63 if (GetGame().IsServer())
64 {
66
68 {
71 }
72 }
73
74 if (cooking_state_update == 1)
75 {
77
78 if (GetGame().IsServer())
79 action_data.m_Player.GetSoftSkillsManager().AddSpecialty(m_Action.GetSpecialtyWeight());
80 else
81 {
82 if (m_ItemToCook.IsMeat() && m_ItemToCook.GetFoodStage().GetFoodStageType() == FoodStageType.BAKED)
83 GetGame().GetAnalyticsClient().OnActionCookedSteak();
84 }
85 }
86
88 }
89
90 return UA_PROCESSING;
91 }
92 else
93 {
94 if (m_SpentUnits)
95 {
98 }
100 return UA_FINISHED;
101 }
102 }
103
104 override float GetProgress()
105 {
106 if (m_AdjustedTimeToCook != 0)
108
109 return 1;
110 }
111};
CookingMethodType
Definition Cooking.c:2
FoodStageType
Definition FoodStage.c:2
void SetACData(Param units)
Definition CABase.c:38
ActionBase m_Action
Definition CABase.c:3
void OnCompletePogress(ActionData action_data)
override int Execute(ActionData action_data)
void CAContinuousTimeCooking(float cooking_update_time)
override void Setup(ActionData action_data)
ref Param1< float > m_SpentUnits
override bool IsMeat()
FoodStage GetFoodStage()
proto native CGame GetGame()
const float FIRE_ATTACHMENT_DAMAGE_PER_SECOND
various damage per second constants
Definition constants.c:727
const int UA_FINISHED
Definition constants.c:436
const int UA_ERROR
Definition constants.c:455
const int UA_PROCESSING
Definition constants.c:434